mirror of
https://github.com/facebook/sapling.git
synced 2025-01-06 04:43:19 +03:00
rust: Replace derive(Fail) with derive(Error)
Summary: This diff replaces code of the form: ``` use failure::Fail; #[derive(Fail, Debug)] pub enum ErrorKind { #[fail(display = "something failed {} times", _0)] Failed(usize), } ``` with: ``` use thiserror::Error; #[derive(Error, Debug)] pub enum ErrorKind { #[error("something failed {0} times")] Failed(usize), } ``` The former emits an implementation of failure 0.1's `Fail` trait while the latter emits an impl of `std::error::Error`. Failure provides a blanket impl of `Fail` for any type that implements `Error`, so these `Error` impls are strictly more general. Each of these error types will continue to have exactly the same `Fail` impl that it did before this change, but now also has the appropriate `std::error::Error` impl which sets us up for dropping our various dependencies on `Fail` throughout the codebase. Reviewed By: Imxset21 Differential Revision: D18523700 fbshipit-source-id: 0e43b10d5dfa79820663212391ecbf4aeaac2d41
This commit is contained in:
parent
f4b0eb7d41
commit
a6c9a3844a
@ -29,7 +29,7 @@ use bytes::Bytes;
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use derived_data::{BonsaiDerived, BonsaiDerivedMapping};
|
||||
use failure_ext::{Error, Fail};
|
||||
use failure_ext::Error;
|
||||
use futures::{future, stream::FuturesUnordered, Future, Stream};
|
||||
use futures_ext::{spawn_future, BoxFuture, FutureExt, StreamExt};
|
||||
use manifest::{find_intersection_of_diffs, Entry};
|
||||
@ -37,6 +37,7 @@ use mononoke_types::{BonsaiChangeset, ChangesetId, FileUnodeId, ManifestUnodeId}
|
||||
use std::collections::HashMap;
|
||||
use std::iter::FromIterator;
|
||||
use std::sync::Arc;
|
||||
use thiserror::Error;
|
||||
use unodes::{RootUnodeManifestId, RootUnodeManifestMapping};
|
||||
|
||||
mod fastlog_impl;
|
||||
@ -74,13 +75,13 @@ pub enum FastlogParent {
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "invalid Thrift structure '{}': {}", _0, _1)]
|
||||
#[error("invalid Thrift structure '{0}': {1}")]
|
||||
InvalidThrift(String, String),
|
||||
#[fail(display = "Fastlog batch for {:?} unode not found", _0)]
|
||||
#[error("Fastlog batch for {0:?} unode not found")]
|
||||
NotFound(Entry<ManifestUnodeId, FileUnodeId>),
|
||||
#[fail(display = "Failed to deserialize FastlogBatch for {}: {}", _0, _1)]
|
||||
#[error("Failed to deserialize FastlogBatch for {0}: {1}")]
|
||||
DeserializationError(String, String),
|
||||
}
|
||||
|
||||
|
@ -9,14 +9,13 @@
|
||||
#![deny(warnings)]
|
||||
|
||||
use ascii::AsciiString;
|
||||
use failure_ext::failure;
|
||||
use failure_ext::Fail;
|
||||
use mercurial_types::{
|
||||
blobs::HgBlobChangeset, HgBlob, HgChangesetId, HgFileNodeId, HgManifestId, HgNodeHash,
|
||||
HgParents, MPath, RepoPath, Type,
|
||||
};
|
||||
use mononoke_types::{hash::Sha256, ChangesetId};
|
||||
use std::fmt;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum StateOpenError {
|
||||
@ -41,106 +40,93 @@ impl fmt::Display for StateOpenError {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "Missing typed key entry for key: {}", _0)]
|
||||
#[error("Missing typed key entry for key: {0}")]
|
||||
MissingTypedKeyEntry(String),
|
||||
// TODO(anastasiyaz): Use general Alias Key instead of Sha256
|
||||
#[fail(display = "Incorrect content of alias blob: {}", _0)]
|
||||
#[error("Incorrect content of alias blob: {0}")]
|
||||
IncorrectAliasBlobContent(Sha256),
|
||||
#[fail(display = "Error while opening state for {}", _0)]
|
||||
#[error("Error while opening state for {0}")]
|
||||
StateOpen(StateOpenError),
|
||||
#[fail(display = "Changeset id {} is missing", _0)]
|
||||
#[error("Changeset id {0} is missing")]
|
||||
ChangesetMissing(HgChangesetId),
|
||||
#[fail(
|
||||
display = "Error while deserializing changeset retrieved from key '{}'",
|
||||
_0
|
||||
)]
|
||||
#[error("Error while deserializing changeset retrieved from key '{0}'")]
|
||||
ChangesetDeserializeFailed(String),
|
||||
#[fail(display = "Manifest id {} is missing", _0)]
|
||||
#[error("Manifest id {0} is missing")]
|
||||
ManifestMissing(HgManifestId),
|
||||
#[fail(display = "Node id {} is missing", _0)]
|
||||
#[error("Node id {0} is missing")]
|
||||
NodeMissing(HgNodeHash),
|
||||
#[fail(display = "Content missing nodeid {}", _0)]
|
||||
#[error("Content missing nodeid {0}")]
|
||||
ContentMissing(HgNodeHash),
|
||||
#[fail(
|
||||
display = "Error while deserializing file contents retrieved from key '{}'",
|
||||
_0
|
||||
)]
|
||||
#[error("Error while deserializing file contents retrieved from key '{0}'")]
|
||||
FileContentsDeserializeFailed(String),
|
||||
#[fail(display = "Content blob missing for id: {}", _0)]
|
||||
#[error("Content blob missing for id: {0}")]
|
||||
ContentBlobByAliasMissing(Sha256),
|
||||
#[fail(display = "Uploaded blob is incomplete {:?}", _0)]
|
||||
#[error("Uploaded blob is incomplete {0:?}")]
|
||||
BadUploadBlob(HgBlob),
|
||||
#[fail(display = "HgParents are not in blob store {:?}", _0)]
|
||||
#[error("HgParents are not in blob store {0:?}")]
|
||||
ParentsUnknown(HgParents),
|
||||
#[fail(display = "Serialization of node failed {} ({})", _0, _1)]
|
||||
#[error("Serialization of node failed {0} ({1})")]
|
||||
SerializationFailed(HgNodeHash, bincode::Error),
|
||||
#[fail(display = "Root manifest is not a manifest (type {})", _0)]
|
||||
#[error("Root manifest is not a manifest (type {0})")]
|
||||
BadRootManifest(Type),
|
||||
#[fail(display = "Manifest type {} does not match uploaded type {}", _0, _1)]
|
||||
#[error("Manifest type {0} does not match uploaded type {1}")]
|
||||
ManifestTypeMismatch(Type, Type),
|
||||
#[fail(display = "Node generation failed for unknown reason")]
|
||||
#[error("Node generation failed for unknown reason")]
|
||||
NodeGenerationFailed,
|
||||
#[fail(display = "Path {} appears multiple times in manifests", _0)]
|
||||
#[error("Path {0} appears multiple times in manifests")]
|
||||
DuplicateEntry(RepoPath),
|
||||
#[fail(display = "Duplicate manifest hash {}", _0)]
|
||||
#[error("Duplicate manifest hash {0}")]
|
||||
DuplicateManifest(HgNodeHash),
|
||||
#[fail(display = "Missing entries in new changeset {}", _0)]
|
||||
#[error("Missing entries in new changeset {0}")]
|
||||
MissingEntries(HgNodeHash),
|
||||
#[fail(display = "Filenode is missing: {} {}", _0, _1)]
|
||||
#[error("Filenode is missing: {0} {1}")]
|
||||
MissingFilenode(RepoPath, HgFileNodeId),
|
||||
#[fail(display = "Some manifests do not exist")]
|
||||
#[error("Some manifests do not exist")]
|
||||
MissingManifests,
|
||||
#[fail(display = "Expected {} to be a manifest, found a {} instead", _0, _1)]
|
||||
#[error("Expected {0} to be a manifest, found a {1} instead")]
|
||||
NotAManifest(HgNodeHash, Type),
|
||||
#[fail(
|
||||
display = "Inconsistent node hash for changeset: provided: {}, \
|
||||
computed: {} for blob: {:#?}",
|
||||
_0, _1, _2
|
||||
#[error(
|
||||
"Inconsistent node hash for changeset: provided: {0}, \
|
||||
computed: {1} for blob: {2:#?}"
|
||||
)]
|
||||
InconsistentChangesetHash(HgNodeHash, HgNodeHash, HgBlobChangeset),
|
||||
#[fail(display = "Bookmark {} does not exist", _0)]
|
||||
#[error("Bookmark {0} does not exist")]
|
||||
BookmarkNotFound(AsciiString),
|
||||
#[fail(display = "Unresolved conflicts when converting BonsaiChangeset to Manifest")]
|
||||
#[error("Unresolved conflicts when converting BonsaiChangeset to Manifest")]
|
||||
UnresolvedConflicts,
|
||||
#[fail(display = "Manifest without parents did not get changed by a BonsaiChangeset")]
|
||||
#[error("Manifest without parents did not get changed by a BonsaiChangeset")]
|
||||
UnchangedManifest,
|
||||
#[fail(display = "Saving empty manifest which is not a root: {}", _0)]
|
||||
#[error("Saving empty manifest which is not a root: {0}")]
|
||||
SavingHgEmptyManifest(RepoPath),
|
||||
#[fail(
|
||||
display = "Trying to merge a manifest with two existing parents p1 {} and p2 {}",
|
||||
_0, _1
|
||||
)]
|
||||
#[error("Trying to merge a manifest with two existing parents p1 {0} and p2 {1}")]
|
||||
ManifestAlreadyAMerge(HgNodeHash, HgNodeHash),
|
||||
#[fail(display = "Path not found: {}", _0)]
|
||||
#[error("Path not found: {0}")]
|
||||
PathNotFound(MPath),
|
||||
#[fail(display = "Remove called on non-directory")]
|
||||
#[error("Remove called on non-directory")]
|
||||
NotADirectory,
|
||||
#[fail(display = "Empty file path")]
|
||||
#[error("Empty file path")]
|
||||
EmptyFilePath,
|
||||
#[fail(display = "Memory manifest conflict can not contain single entry")]
|
||||
#[error("Memory manifest conflict can not contain single entry")]
|
||||
SingleEntryConflict,
|
||||
#[fail(display = "Cannot find cache pool {}", _0)]
|
||||
#[error("Cannot find cache pool {0}")]
|
||||
MissingCachePool(String),
|
||||
#[fail(display = "Bonsai cs {} not found", _0)]
|
||||
#[error("Bonsai cs {0} not found")]
|
||||
BonsaiNotFound(ChangesetId),
|
||||
#[fail(display = "Bonsai changeset not found for hg changeset {}", _0)]
|
||||
#[error("Bonsai changeset not found for hg changeset {0}")]
|
||||
BonsaiMappingNotFound(HgChangesetId),
|
||||
#[fail(display = "Root path wasn't expected at this context")]
|
||||
#[error("Root path wasn't expected at this context")]
|
||||
UnexpectedRootPath,
|
||||
#[fail(
|
||||
display = "Incorrect copy info: not found a file version {} {} the file {} {} was copied from",
|
||||
from_path, from_node, to_path, to_node
|
||||
)]
|
||||
#[error("Incorrect copy info: not found a file version {from_path} {from_node} the file {to_path} {to_node} was copied from")]
|
||||
IncorrectCopyInfo {
|
||||
from_path: MPath,
|
||||
from_node: HgFileNodeId,
|
||||
to_path: MPath,
|
||||
to_node: HgFileNodeId,
|
||||
},
|
||||
#[fail(display = "Case conflict in a commit")]
|
||||
#[error("Case conflict in a commit")]
|
||||
CaseConflict(MPath),
|
||||
#[fail(display = "Mercurial entry can not have more than two parents")]
|
||||
#[error("Mercurial entry can not have more than two parents")]
|
||||
TooManyParents,
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ use std::collections::{HashMap, HashSet, VecDeque};
|
||||
use crate::repo::BlobRepo;
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure_ext::{Error, Fail};
|
||||
use failure_ext::Error;
|
||||
use filenodes::FilenodeInfo;
|
||||
use futures::{future::ok, stream, Future, Stream};
|
||||
use futures_ext::{BoxStream, FutureExt, StreamExt};
|
||||
@ -19,10 +19,11 @@ use maplit::hashset;
|
||||
use mercurial_types::{
|
||||
HgFileHistoryEntry, HgFileNodeId, HgParents, MPath, RepoPath, NULL_CSID, NULL_HASH,
|
||||
};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "internal error: file {} copied from directory {}", _0, _1)]
|
||||
#[error("internal error: file {0} copied from directory {1}")]
|
||||
InconsistentCopyInfo(RepoPath, RepoPath),
|
||||
}
|
||||
|
||||
|
@ -6,14 +6,15 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
pub use failure::{Error, Fail};
|
||||
pub use failure::Error;
|
||||
pub use failure_ext::{Result, ResultExt};
|
||||
use mercurial_types::HgChangesetId;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "While visiting changeset {}", _0)]
|
||||
#[error("While visiting changeset {0}")]
|
||||
VisitError(HgChangesetId),
|
||||
#[fail(display = "While verifying changeset {}", _0)]
|
||||
#[error("While verifying changeset {0}")]
|
||||
VerificationError(HgChangesetId),
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ use blobstore::Blobstore;
|
||||
use cloned::cloned;
|
||||
use context::{CoreContext, PerfCounterType};
|
||||
use failure::err_msg;
|
||||
use failure_ext::{Error, Fail};
|
||||
use failure_ext::Error;
|
||||
use futures::future::{self, Future, Loop};
|
||||
use futures_ext::{BoxFuture, FutureExt};
|
||||
use futures_stats::Timed;
|
||||
@ -26,6 +26,7 @@ use std::sync::{
|
||||
Arc,
|
||||
};
|
||||
use std::time::Duration;
|
||||
use thiserror::Error;
|
||||
use time_ext::DurationExt;
|
||||
use tokio::executor::spawn;
|
||||
use tokio::prelude::FutureExt as TokioFutureExt;
|
||||
@ -39,20 +40,19 @@ type BlobstoresWithEntry = HashSet<BlobstoreId>;
|
||||
type BlobstoresReturnedNone = HashSet<BlobstoreId>;
|
||||
type BlobstoresReturnedError = HashMap<BlobstoreId, Error>;
|
||||
|
||||
#[derive(Fail, Debug, Clone)]
|
||||
#[derive(Error, Debug, Clone)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "Some blobstores failed, and other returned None: {:?}", _0)]
|
||||
#[error("Some blobstores failed, and other returned None: {0:?}")]
|
||||
SomeFailedOthersNone(Arc<BlobstoresReturnedError>),
|
||||
#[fail(display = "All blobstores failed: {:?}", _0)]
|
||||
#[error("All blobstores failed: {0:?}")]
|
||||
AllFailed(Arc<BlobstoresReturnedError>),
|
||||
// Errors below this point are from ScrubBlobstore only. If they include an
|
||||
// Option<BlobstoreBytes>, this implies that this error is recoverable
|
||||
#[fail(
|
||||
display = "Different blobstores have different values for this item: {:?} differ, {:?} do not have",
|
||||
_0, _1
|
||||
#[error(
|
||||
"Different blobstores have different values for this item: {0:?} differ, {1:?} do not have"
|
||||
)]
|
||||
ValueMismatch(Arc<BlobstoresWithEntry>, Arc<BlobstoresReturnedNone>),
|
||||
#[fail(display = "Some blobstores missing this item: {:?}", _0)]
|
||||
#[error("Some blobstores missing this item: {0:?}")]
|
||||
SomeMissingItem(Arc<BlobstoresReturnedNone>, Option<BlobstoreBytes>),
|
||||
}
|
||||
|
||||
|
@ -6,10 +6,10 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use failure_ext::Fail;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "Attempt to put to ReadOnlyBlobstore for key {}", _0)]
|
||||
#[error("Attempt to put to ReadOnlyBlobstore for key {0}")]
|
||||
ReadOnlyPut(String),
|
||||
}
|
||||
|
@ -6,10 +6,10 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use failure_ext::Fail;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "The blob {} is censored. \n Task/Sev: {}", _0, _1)]
|
||||
#[error("The blob {0} is censored. \n Task/Sev: {1}")]
|
||||
Censored(String, String),
|
||||
}
|
||||
|
@ -6,12 +6,12 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use failure_ext::Fail;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "Blob {} not found in blobstore", _0)]
|
||||
#[error("Blob {0} not found in blobstore")]
|
||||
NotFound(String),
|
||||
#[fail(display = "Error while opening state for blob store")]
|
||||
#[error("Error while opening state for blob store")]
|
||||
StateOpen,
|
||||
}
|
||||
|
@ -12,9 +12,10 @@ use bytes::Bytes;
|
||||
use std::fmt;
|
||||
use std::sync::Arc;
|
||||
|
||||
use failure_ext::{Error, Fail};
|
||||
use failure_ext::Error;
|
||||
use futures::future::{self, Future};
|
||||
use futures_ext::{BoxFuture, FutureExt};
|
||||
use thiserror::Error;
|
||||
|
||||
use asyncmemo::Weight;
|
||||
use context::CoreContext;
|
||||
@ -164,11 +165,11 @@ impl Blobstore for Box<dyn Blobstore> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum LoadableError {
|
||||
#[fail(display = "Internal error: {}", _0)]
|
||||
#[error("Internal error: {0}")]
|
||||
Error(Error),
|
||||
#[fail(display = "Blob is missing: {}", _0)]
|
||||
#[error("Blob is missing: {0}")]
|
||||
Missing(String),
|
||||
}
|
||||
|
||||
|
@ -7,15 +7,13 @@
|
||||
*/
|
||||
|
||||
use super::BonsaiGlobalrevMappingEntry;
|
||||
pub use failure_ext::{Error, Fail, Result};
|
||||
pub use failure_ext::{Error, Result};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Eq, Fail, PartialEq)]
|
||||
#[derive(Debug, Eq, Error, PartialEq)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "Conflicting entries: stored:{:?} current:{:?}", _0, _1)]
|
||||
#[error("Conflicting entries: stored:{0:?} current:{1:?}")]
|
||||
ConflictingEntries(BonsaiGlobalrevMappingEntry, BonsaiGlobalrevMappingEntry),
|
||||
#[fail(
|
||||
display = "Conflict detected during insert, but no value was there for: {:?}",
|
||||
_0
|
||||
)]
|
||||
#[error("Conflict detected during insert, but no value was there for: {0:?}")]
|
||||
RaceConditionWithDelete(BonsaiGlobalrevMappingEntry),
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ use std::collections::HashSet;
|
||||
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure_ext as failure;
|
||||
use failure_ext::Error;
|
||||
use futures::future::Future;
|
||||
use futures::{future, IntoFuture};
|
||||
|
@ -7,17 +7,15 @@
|
||||
*/
|
||||
|
||||
use super::BonsaiHgMappingEntry;
|
||||
pub use failure_ext::{Error, Fail, Result};
|
||||
pub use failure_ext::{Error, Result};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Eq, Fail, PartialEq)]
|
||||
#[derive(Debug, Eq, Error, PartialEq)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "Connection error")]
|
||||
#[error("Connection error")]
|
||||
ConnectionError,
|
||||
#[fail(display = "Conflicting entries: stored:{:?} current:{:?}", _0, _1)]
|
||||
#[error("Conflicting entries: stored:{0:?} current:{1:?}")]
|
||||
ConflictingEntries(BonsaiHgMappingEntry, BonsaiHgMappingEntry),
|
||||
#[fail(
|
||||
display = "Conflict detected during insert, but no value was there for: {:?}",
|
||||
_0
|
||||
)]
|
||||
#[error("Conflict detected during insert, but no value was there for: {0:?}")]
|
||||
RaceConditionWithDelete(BonsaiHgMappingEntry),
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ pub use sql_ext::SqlConstructors;
|
||||
use abomonation_derive::Abomonation;
|
||||
use cloned::cloned;
|
||||
use context::{CoreContext, PerfCounterType};
|
||||
use failure_ext as failure;
|
||||
use futures::{future, Future, IntoFuture};
|
||||
use futures_ext::{BoxFuture, FutureExt};
|
||||
use heapsize_derive::HeapSizeOf;
|
||||
|
@ -23,14 +23,14 @@ use upload_trace::{manifold_thrift::thrift::RequestContext, UploadTrace};
|
||||
|
||||
mod errors {
|
||||
use bookmarks::BookmarkName;
|
||||
use failure::Fail;
|
||||
use mercurial_types::HgChangesetId;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "Bookmark {} does not exist", _0)]
|
||||
#[error("Bookmark {0} does not exist")]
|
||||
BookmarkNotFound(BookmarkName),
|
||||
#[fail(display = "Bookmark value {} not found", _0)]
|
||||
#[error("Bookmark value {0} not found")]
|
||||
BookmarkValueNotFound(HgChangesetId),
|
||||
}
|
||||
}
|
||||
|
@ -6,18 +6,15 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use failure::Fail;
|
||||
pub use failure_ext::{Error, Result};
|
||||
use thiserror::Error;
|
||||
|
||||
use mononoke_types::ChangesetId;
|
||||
|
||||
#[derive(Debug, Eq, Fail, PartialEq)]
|
||||
#[derive(Debug, Eq, Error, PartialEq)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(
|
||||
display = "Duplicate changeset {} has different parents: {:?} vs {:?}",
|
||||
_0, _1, _2
|
||||
)]
|
||||
#[error("Duplicate changeset {0} has different parents: {1:?} vs {2:?}")]
|
||||
DuplicateInsertionInconsistency(ChangesetId, Vec<ChangesetId>, Vec<ChangesetId>),
|
||||
#[fail(display = "Missing parents")]
|
||||
#[error("Missing parents")]
|
||||
MissingParents(Vec<ChangesetId>),
|
||||
}
|
||||
|
@ -16,10 +16,11 @@ use mononoke_types::RepositoryId;
|
||||
use std::collections::HashSet;
|
||||
use std::iter::Iterator;
|
||||
use std::sync::Arc;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Eq, Fail, PartialEq)]
|
||||
#[derive(Debug, Eq, Error, PartialEq)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "Small repo {} not found", _0)]
|
||||
#[error("Small repo {0} not found")]
|
||||
SmallRepoNotFound(RepositoryId),
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ use blobsync::copy_content;
|
||||
use bookmark_renaming::{get_large_to_small_renamer, get_small_to_large_renamer, BookmarkRenamer};
|
||||
use bookmarks::BookmarkName;
|
||||
use context::CoreContext;
|
||||
use failure::{err_msg, Error, Fail};
|
||||
use failure::{err_msg, Error};
|
||||
use futures::Future;
|
||||
use futures_preview::{
|
||||
compat::Future01CompatExt,
|
||||
@ -34,29 +34,21 @@ use synced_commit_mapping::{
|
||||
EquivalentWorkingCopyEntry, SyncedCommitMapping, SyncedCommitMappingEntry,
|
||||
WorkingCopyEquivalence,
|
||||
};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(
|
||||
display = "Pushrebase of synced commit failed - check config for overlaps: {:?}",
|
||||
_0
|
||||
)]
|
||||
#[error("Pushrebase of synced commit failed - check config for overlaps: {0:?}")]
|
||||
PushrebaseFailure(PushrebaseError),
|
||||
#[fail(
|
||||
display = "Remapped commit {} expected in target repo, but not present",
|
||||
_0
|
||||
)]
|
||||
#[error("Remapped commit {0} expected in target repo, but not present")]
|
||||
MissingRemappedCommit(ChangesetId),
|
||||
#[fail(
|
||||
display = "Could not find a commit in the target repo with the same working copy as {}",
|
||||
_0
|
||||
)]
|
||||
#[error("Could not find a commit in the target repo with the same working copy as {0}")]
|
||||
SameWcSearchFail(ChangesetId),
|
||||
#[fail(display = "Parent commit {} hasn't been remapped", _0)]
|
||||
#[error("Parent commit {0} hasn't been remapped")]
|
||||
ParentNotRemapped(ChangesetId),
|
||||
#[fail(display = "Parent commit {} is not a sync candidate", _0)]
|
||||
#[error("Parent commit {0} is not a sync candidate")]
|
||||
ParentNotSyncCandidate(ChangesetId),
|
||||
#[fail(display = "Cannot choose working copy equivalent for {}", _0)]
|
||||
#[error("Cannot choose working copy equivalent for {0}")]
|
||||
AmbiguousWorkingCopyEquivalent(ChangesetId),
|
||||
}
|
||||
|
||||
|
@ -19,19 +19,17 @@ use std::collections::{HashMap, HashSet};
|
||||
use std::convert::TryFrom;
|
||||
use std::iter::Iterator;
|
||||
use std::sync::Arc;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "Cannot remove prefix, equal to the whole path")]
|
||||
#[error("Cannot remove prefix, equal to the whole path")]
|
||||
RemovePrefixWholePathFailure,
|
||||
#[fail(display = "Cannot apply prefix action {:?} to {:?}", _0, _1)]
|
||||
#[error("Cannot apply prefix action {0:?} to {1:?}")]
|
||||
PrefixActionFailure(PrefixAction, MPath),
|
||||
#[fail(display = "Small repo {} not found", _0)]
|
||||
#[error("Small repo {0} not found")]
|
||||
SmallRepoNotFound(RepositoryId),
|
||||
#[fail(
|
||||
display = "Provided map is not prefix-free (e.g. {:?} and {:?})",
|
||||
_0, _1
|
||||
)]
|
||||
#[error("Provided map is not prefix-free (e.g. {0:?} and {1:?})")]
|
||||
NonPrefixFreeMap(MPath, MPath),
|
||||
}
|
||||
|
||||
|
@ -15,19 +15,17 @@ pub use sql_ext::SqlConstructors;
|
||||
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure_ext::{Error, Fail};
|
||||
use failure_ext::Error;
|
||||
use futures::{future, Future};
|
||||
use futures_ext::{BoxFuture, FutureExt};
|
||||
use mononoke_types::{ChangesetId, RepositoryId};
|
||||
use sql::queries;
|
||||
use stats::{define_stats, Timeseries};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Eq, Fail, PartialEq)]
|
||||
#[derive(Debug, Eq, Error, PartialEq)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(
|
||||
display = "tried to insert inconsistent small bcs id {:?}, while db has {:?}",
|
||||
_0, _1
|
||||
)]
|
||||
#[error("tried to insert inconsistent small bcs id {expected:?}, while db has {actual:?}")]
|
||||
InconsistentWorkingCopyEntry {
|
||||
expected: Option<ChangesetId>,
|
||||
actual: Option<ChangesetId>,
|
||||
|
@ -20,7 +20,7 @@ use bytes::Bytes;
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use derived_data::BonsaiDerived;
|
||||
use failure::{format_err, Error, Fail};
|
||||
use failure::{format_err, Error};
|
||||
use futures::{future, Future};
|
||||
use futures_ext::FutureExt;
|
||||
use manifest::ManifestOps;
|
||||
@ -29,13 +29,14 @@ use mononoke_types::{
|
||||
ChangesetId, MPath,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
use thiserror::Error;
|
||||
use unodes::{RootUnodeManifestId, RootUnodeManifestMapping};
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum BlameError {
|
||||
#[fail(display = "{}", _0)]
|
||||
#[error("{0}")]
|
||||
Rejected(BlameRejected),
|
||||
#[fail(display = "{}", _0)]
|
||||
#[error("{0}")]
|
||||
Error(Error),
|
||||
}
|
||||
|
||||
|
@ -8,22 +8,22 @@
|
||||
|
||||
#![deny(warnings)]
|
||||
|
||||
use failure_ext::Fail;
|
||||
use mononoke_types::{ContentId, FsnodeId};
|
||||
use thiserror::Error;
|
||||
|
||||
mod derive;
|
||||
mod mapping;
|
||||
|
||||
pub use mapping::{RootFsnodeId, RootFsnodeMapping};
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "Invalid bonsai changeset: {}", _0)]
|
||||
#[error("Invalid bonsai changeset: {0}")]
|
||||
InvalidBonsai(String),
|
||||
#[fail(display = "Missing content: {}", _0)]
|
||||
#[error("Missing content: {0}")]
|
||||
MissingContent(ContentId),
|
||||
#[fail(display = "Missing fsnode parent: {}", _0)]
|
||||
#[error("Missing fsnode parent: {0}")]
|
||||
MissingParent(FsnodeId),
|
||||
#[fail(display = "Missing fsnode subentry for '{}': {}", _0, _1)]
|
||||
#[error("Missing fsnode subentry for '{0}': {1}")]
|
||||
MissingSubentry(String, FsnodeId),
|
||||
}
|
||||
|
@ -12,21 +12,22 @@ use blobrepo::BlobRepo;
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use derived_data::BonsaiDerived;
|
||||
use failure_ext::{Error, Fail};
|
||||
use failure_ext::Error;
|
||||
use futures::{future, Future, Stream};
|
||||
use futures_ext::{BoxFuture, FutureExt};
|
||||
use manifest::ManifestOps;
|
||||
use mononoke_types::{BonsaiChangeset, ChangesetId, FileUnodeId, MPath};
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
use thiserror::Error;
|
||||
|
||||
mod derive;
|
||||
mod mapping;
|
||||
|
||||
pub use mapping::{RootUnodeManifestId, RootUnodeManifestMapping};
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "Invalid bonsai changeset: {}", _0)]
|
||||
#[error("Invalid bonsai changeset: {0}")]
|
||||
InvalidBonsai(String),
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# @autocargo from //common/rust/failure_ext:failure_ext
|
||||
# Signature<<f75d246c560d46a5b3c1ae4f12a8c39eb68d415c>>
|
||||
# Signature<<47c17cafb1fd9379d31c2aafce77a3146013d430>>
|
||||
[package]
|
||||
name = "failure_ext"
|
||||
edition = "2018"
|
||||
@ -12,4 +12,5 @@ failure = "*"
|
||||
failure_derive = "*"
|
||||
futures = "0.1"
|
||||
slog = { version="*", features=["max_level_debug"] }
|
||||
# @end of Signature<<f75d246c560d46a5b3c1ae4f12a8c39eb68d415c>>
|
||||
thiserror = "*"
|
||||
# @end of Signature<<47c17cafb1fd9379d31c2aafce77a3146013d430>>
|
||||
|
@ -7,15 +7,16 @@
|
||||
*/
|
||||
|
||||
use super::*;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Fail, Debug)]
|
||||
#[fail(display = "RootError badness")]
|
||||
#[derive(Error, Debug)]
|
||||
#[error("RootError badness")]
|
||||
struct RootError;
|
||||
#[derive(Fail, Debug)]
|
||||
#[fail(display = "Bar badness")]
|
||||
#[derive(Error, Debug)]
|
||||
#[error("Bar badness")]
|
||||
struct Bar;
|
||||
#[derive(Fail, Debug)]
|
||||
#[fail(display = "Blat badness")]
|
||||
#[derive(Error, Debug)]
|
||||
#[error("Blat badness")]
|
||||
struct Blat;
|
||||
|
||||
#[test]
|
||||
|
@ -6,37 +6,22 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use failure_ext::Fail;
|
||||
pub use failure_ext::{Error, Result};
|
||||
use mercurial_types::{HgFileNodeId, RepoPath};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Eq, Fail, PartialEq)]
|
||||
#[derive(Debug, Eq, Error, PartialEq)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "Invalid copy: {:?} copied from {:?}", _0, _1)]
|
||||
#[error("Invalid copy: {0:?} copied from {1:?}")]
|
||||
InvalidCopy(RepoPath, RepoPath),
|
||||
#[fail(
|
||||
display = "Internal error: failure while fetching file node {} {}",
|
||||
_0, _1
|
||||
)]
|
||||
#[error("Internal error: failure while fetching file node {0} {1}")]
|
||||
FailFetchFilenode(HgFileNodeId, RepoPath),
|
||||
#[fail(
|
||||
display = "Internal error: failure while fetching copy information {} {}",
|
||||
_0, _1
|
||||
)]
|
||||
#[error("Internal error: failure while fetching copy information {0} {1}")]
|
||||
FailFetchCopydata(HgFileNodeId, RepoPath),
|
||||
#[fail(
|
||||
display = "Internal error: copy information is not found for {} {}",
|
||||
_0, _1
|
||||
)]
|
||||
#[error("Internal error: copy information is not found for {0} {1}")]
|
||||
CopydataNotFound(HgFileNodeId, RepoPath),
|
||||
#[fail(
|
||||
display = "Internal error: failure while fetching file nodes for {}",
|
||||
_0
|
||||
)]
|
||||
#[error("Internal error: failure while fetching file nodes for {0}")]
|
||||
FailRangeFetch(RepoPath),
|
||||
#[fail(
|
||||
display = "Internal error: failure while fetching copy source path for {}",
|
||||
_0
|
||||
)]
|
||||
#[error("Internal error: failure while fetching copy source path for {0}")]
|
||||
FromPathNotFound(RepoPath),
|
||||
}
|
||||
|
@ -6,8 +6,8 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use failure_ext::Fail;
|
||||
use std::fmt::Debug;
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::expected_size::ExpectedSize;
|
||||
use mononoke_types::{
|
||||
@ -21,20 +21,20 @@ pub struct InvalidHash<T: Debug> {
|
||||
pub effective: T,
|
||||
}
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "Invalid size: {:?} was expected, {:?} was observed", _0, _1)]
|
||||
#[error("Invalid size: {0:?} was expected, {1:?} was observed")]
|
||||
InvalidSize(ExpectedSize, u64),
|
||||
|
||||
#[fail(display = "Invalid ContentId: {:?}", _0)]
|
||||
#[error("Invalid ContentId: {0:?}")]
|
||||
InvalidContentId(InvalidHash<ContentId>),
|
||||
|
||||
#[fail(display = "Invalid Sha1: {:?}", _0)]
|
||||
#[error("Invalid Sha1: {0:?}")]
|
||||
InvalidSha1(InvalidHash<Sha1>),
|
||||
|
||||
#[fail(display = "Invalid Sha256: {:?}", _0)]
|
||||
#[error("Invalid Sha256: {0:?}")]
|
||||
InvalidSha256(InvalidHash<Sha256>),
|
||||
|
||||
#[fail(display = "Invalid GitSha1: {:?}", _0)]
|
||||
#[error("Invalid GitSha1: {0:?}")]
|
||||
InvalidGitSha1(InvalidHash<GitSha1>),
|
||||
}
|
||||
|
@ -12,20 +12,21 @@ use blobstore::{Blobstore, Loadable, LoadableError};
|
||||
use bytes::Bytes;
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure_ext::{Error, Fail};
|
||||
use failure_ext::Error;
|
||||
use futures::{stream, Future, Stream};
|
||||
use futures_ext::{BufferedParams, FutureExt, StreamExt};
|
||||
use itertools::Either;
|
||||
use mononoke_types::{ContentChunk, ContentChunkId, ContentId, FileContents};
|
||||
use thiserror::Error;
|
||||
|
||||
// TODO: Make this configurable? Perhaps as a global, since it's something that only makes sense at
|
||||
// the program level (as opposed to e;g. chunk size, which makes sense at the repo level).
|
||||
const BUFFER_MEMORY_BUDGET: u64 = 16 * 1024 * 1024; // 16MB.
|
||||
const BUFFER_MAX_SIZE: usize = 1024; // Fairly arbitrarily large buffer size (we rely on weight).
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "Chunk not found: {:?}", _0)]
|
||||
#[error("Chunk not found: {0:?}")]
|
||||
ChunkNotFound(ContentChunkId),
|
||||
}
|
||||
|
||||
|
@ -9,21 +9,22 @@
|
||||
use blobstore::{Blobstore, Loadable, LoadableError, Storable};
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure_ext::{Error, Fail};
|
||||
use failure_ext::Error;
|
||||
use futures::{Future, IntoFuture};
|
||||
use futures_ext::FutureExt;
|
||||
use mononoke_types::{BlobstoreValue, ContentId, ContentMetadata, ContentMetadataId};
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::alias::alias_stream;
|
||||
use crate::expected_size::ExpectedSize;
|
||||
use crate::fetch;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum RebuildBackmappingError {
|
||||
#[fail(display = "Not found: {:?}", _0)]
|
||||
#[error("Not found: {0:?}")]
|
||||
NotFound(ContentId),
|
||||
|
||||
#[fail(display = "Error computing metadata for {:?}: {:?}", _0, _1)]
|
||||
#[error("Error computing metadata for {0:?}: {1:?}")]
|
||||
InternalError(ContentId, Error),
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,9 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use failure_ext::{Error, Fail};
|
||||
use failure_ext::Error;
|
||||
use futures::Future;
|
||||
use thiserror::Error;
|
||||
|
||||
use blobstore::{Blobstore, Loadable, LoadableError};
|
||||
use context::CoreContext;
|
||||
@ -15,9 +16,9 @@ use mononoke_types::{ContentId, ContentMetadata};
|
||||
|
||||
use crate::{fetch, store, FilestoreConfig, StoreRequest};
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "Content not found: {:?}", _0)]
|
||||
#[error("Content not found: {0:?}")]
|
||||
ContentNotFound(ContentId),
|
||||
}
|
||||
|
||||
|
@ -8,14 +8,15 @@
|
||||
|
||||
use blobstore::Blobstore;
|
||||
use context::CoreContext;
|
||||
use failure_ext::{Error, Fail};
|
||||
use failure_ext::Error;
|
||||
use futures::future::IntoFuture;
|
||||
use futures_ext::{BoxFuture, FutureExt};
|
||||
use mononoke_types::BlobstoreBytes;
|
||||
use rand::{thread_rng, Rng};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[fail(display = "Failing Blobstore Error")]
|
||||
#[derive(Debug, Error)]
|
||||
#[error("Failing Blobstore Error")]
|
||||
pub struct FailingBlobstoreError;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
@ -6,24 +6,25 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
pub use failure_ext::{Error, Fail, Result};
|
||||
pub use failure_ext::{Error, Result};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "Unimplemented operation '{}'", _0)]
|
||||
#[error("Unimplemented operation '{0}'")]
|
||||
Unimplemented(String),
|
||||
#[fail(display = "command parse failed for '{}'", _0)]
|
||||
#[error("command parse failed for '{0}'")]
|
||||
CommandParse(String),
|
||||
#[fail(display = "unconsumed data left after parsing '{}'", _0)]
|
||||
#[error("unconsumed data left after parsing '{0}'")]
|
||||
UnconsumedData(String),
|
||||
#[fail(display = "malformed batch with command '{}'", _0)]
|
||||
#[error("malformed batch with command '{0}'")]
|
||||
BatchInvalid(String),
|
||||
#[fail(display = "malformed bundle2 '{}'", _0)]
|
||||
#[error("malformed bundle2 '{0}'")]
|
||||
Bundle2Invalid(String),
|
||||
#[fail(display = "unknown escape character in batch command '{}'", _0)]
|
||||
#[error("unknown escape character in batch command '{0}'")]
|
||||
BatchEscape(u8),
|
||||
#[fail(display = "Repo error")]
|
||||
#[error("Repo error")]
|
||||
RepoError,
|
||||
#[fail(display = "cannot serve revlog repos")]
|
||||
#[error("cannot serve revlog repos")]
|
||||
CantServeRevlogRepo,
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ use bookmarks::BookmarkName;
|
||||
use clap::{App, Arg, ArgMatches};
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure_ext::{err_msg, format_err, Error, Fail, Result};
|
||||
use failure_ext::{err_msg, format_err, Error, Result};
|
||||
use fbinit::FacebookInit;
|
||||
use futures::future::{err, ok, result, Future};
|
||||
use futures::stream::repeat;
|
||||
@ -34,6 +34,7 @@ use std::io::{BufRead, BufReader};
|
||||
use std::str::FromStr;
|
||||
use std::time::Duration;
|
||||
use tailer::Tailer;
|
||||
use thiserror::Error;
|
||||
use tokio_timer::sleep;
|
||||
|
||||
pub struct HookResults {
|
||||
@ -361,8 +362,8 @@ fn setup_logger<'a>(matches: &ArgMatches<'a>, repo_name: String) -> Logger {
|
||||
)
|
||||
}
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "No such repo '{}'", _0)]
|
||||
#[error("No such repo '{0}'")]
|
||||
NoSuchRepo(String),
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ use blobrepo::BlobRepo;
|
||||
use bookmarks::BookmarkName;
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure_ext::{err_msg, Error, Fail, Result};
|
||||
use failure_ext::{err_msg, Error, Result};
|
||||
use futures::{Future, Stream};
|
||||
use futures_ext::{spawn_future, BoxFuture, FutureExt};
|
||||
use hooks::{hook_loader::load_hooks, HookManager};
|
||||
@ -26,6 +26,7 @@ use revset::AncestorsNodeStream;
|
||||
use slog::{debug, info};
|
||||
use std::collections::HashSet;
|
||||
use std::sync::Arc;
|
||||
use thiserror::Error;
|
||||
|
||||
pub struct Tailer {
|
||||
ctx: CoreContext,
|
||||
@ -304,12 +305,12 @@ fn run_hooks_for_changeset(
|
||||
})
|
||||
}
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "No such bookmark '{}'", _0)]
|
||||
#[error("No such bookmark '{0}'")]
|
||||
NoSuchBookmark(BookmarkName),
|
||||
#[fail(display = "Cannot find last revision in blobstore")]
|
||||
#[error("Cannot find last revision in blobstore")]
|
||||
NoLastRevision,
|
||||
#[fail(display = "Cannot find bonsai for {}", _0)]
|
||||
#[error("Cannot find bonsai for {0}")]
|
||||
BonsaiNotFound(HgChangesetId),
|
||||
}
|
||||
|
@ -6,10 +6,10 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use failure::Fail;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "No changeset with id '{}'", _0)]
|
||||
#[error("No changeset with id '{0}'")]
|
||||
NoSuchChangeset(String),
|
||||
}
|
||||
|
@ -6,40 +6,37 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use failure::Fail;
|
||||
use std::collections::HashSet;
|
||||
use thiserror::Error;
|
||||
|
||||
pub use mercurial_types::HgChangesetId;
|
||||
use metaconfig_types::BookmarkOrRegex;
|
||||
pub use mononoke_types::MPath;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "No such hook '{}'", _0)]
|
||||
#[error("No such hook '{0}'")]
|
||||
NoSuchHook(String),
|
||||
|
||||
#[fail(display = "Error while parsing hook '{}'", _0)]
|
||||
#[error("Error while parsing hook '{0}'")]
|
||||
HookParseError(String),
|
||||
#[fail(display = "Error while running hook '{}'", _0)]
|
||||
#[error("Error while running hook '{0}'")]
|
||||
HookRuntimeError(String),
|
||||
|
||||
#[fail(display = "invalid file structure: {}", _0)]
|
||||
#[error("invalid file structure: {0}")]
|
||||
InvalidFileStructure(String),
|
||||
#[fail(display = "invalid path: {}", _0)]
|
||||
#[error("invalid path: {0}")]
|
||||
InvalidPath(MPath),
|
||||
|
||||
#[fail(display = "Missing file for cs '{}' path '{}'", _0, _1)]
|
||||
#[error("Missing file for cs '{0}' path '{1}'")]
|
||||
MissingFile(HgChangesetId, MPath),
|
||||
|
||||
#[fail(
|
||||
display = "Hook(s) referenced in bookmark {:#?} do not exist: {:?}",
|
||||
_0, _1
|
||||
)]
|
||||
#[error("Hook(s) referenced in bookmark {0:#?} do not exist: {1:?}")]
|
||||
NoSuchBookmarkHook(BookmarkOrRegex, HashSet<String>),
|
||||
|
||||
#[fail(display = "invalid rust hook: {}", _0)]
|
||||
#[error("invalid rust hook: {0}")]
|
||||
InvalidRustHook(String),
|
||||
|
||||
#[fail(display = "Disabled hook(s) do(es) not exist: {:?}", _0)]
|
||||
#[error("Disabled hook(s) do(es) not exist: {0:?}")]
|
||||
NoSuchHookToDisable(HashSet<String>),
|
||||
}
|
||||
|
@ -8,68 +8,59 @@
|
||||
|
||||
use hyper::StatusCode;
|
||||
|
||||
use failure_ext::Fail;
|
||||
use thiserror::Error;
|
||||
|
||||
use lfs_protocol::{RequestObject, ResponseObject};
|
||||
use mononoke_types::ContentId;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "Client cancelled the request")]
|
||||
#[error("Client cancelled the request")]
|
||||
ClientCancelled,
|
||||
#[fail(display = "An error occurred forwarding the request to upstream")]
|
||||
#[error("An error occurred forwarding the request to upstream")]
|
||||
UpstreamDidNotRespond,
|
||||
#[fail(
|
||||
display = "An error ocurred receiving a response from upstream ({}): {}",
|
||||
_0, _1
|
||||
)]
|
||||
#[error("An error ocurred receiving a response from upstream ({0}): {1}")]
|
||||
UpstreamError(StatusCode, String),
|
||||
#[fail(display = "Could not serialize")]
|
||||
#[error("Could not serialize")]
|
||||
SerializationFailed,
|
||||
#[fail(display = "Could not initialize HTTP client")]
|
||||
#[error("Could not initialize HTTP client")]
|
||||
HttpClientInitializationFailed,
|
||||
#[fail(display = "Repository does not exist: {}", _0)]
|
||||
#[error("Repository does not exist: {0}")]
|
||||
RepositoryDoesNotExist(String),
|
||||
#[fail(display = "Could not build {}", _0)]
|
||||
#[error("Could not build {0}")]
|
||||
UriBuilderFailed(&'static str),
|
||||
#[fail(display = "Invalid Uri {}: {}", _0, _1)]
|
||||
#[error("Invalid Uri {0}: {1}")]
|
||||
InvalidUri(String, &'static str),
|
||||
#[fail(display = "Object does not exist: {}", _0)]
|
||||
#[error("Object does not exist: {0}")]
|
||||
ObjectDoesNotExist(ContentId),
|
||||
#[fail(display = "Could not dispatch batch request to upstream")]
|
||||
#[error("Could not dispatch batch request to upstream")]
|
||||
UpstreamBatchNoResponse,
|
||||
#[fail(display = "Upstream batch response is invalid")]
|
||||
#[error("Upstream batch response is invalid")]
|
||||
UpstreamBatchInvalid,
|
||||
#[fail(display = "Could not fetch upstream batch")]
|
||||
#[error("Could not fetch upstream batch")]
|
||||
UpstreamBatchError,
|
||||
#[fail(display = "Could not perform upstream upload")]
|
||||
#[error("Could not perform upstream upload")]
|
||||
UpstreamUploadError,
|
||||
#[fail(display = "Upstream batch response included an invalid transfer")]
|
||||
#[error("Upstream batch response included an invalid transfer")]
|
||||
UpstreamInvalidTransfer,
|
||||
#[fail(
|
||||
display = "Upstream batch response did not include requested object: {:?}",
|
||||
_0
|
||||
)]
|
||||
#[error("Upstream batch response did not include requested object: {0:?}")]
|
||||
UpstreamMissingObject(RequestObject),
|
||||
#[fail(
|
||||
display = "Upstream batch response included an invalid object: {:?}",
|
||||
_0
|
||||
)]
|
||||
#[error("Upstream batch response included an invalid object: {0:?}")]
|
||||
UpstreamInvalidObject(ResponseObject),
|
||||
#[fail(display = "Could not load local alias")]
|
||||
#[error("Could not load local alias")]
|
||||
LocalAliasLoadError,
|
||||
#[fail(display = "Could not generate download URIs")]
|
||||
#[error("Could not generate download URIs")]
|
||||
GenerateDownloadUrisError,
|
||||
#[fail(display = "Could not generate upload URIs")]
|
||||
#[error("Could not generate upload URIs")]
|
||||
GenerateUploadUrisError,
|
||||
#[fail(display = "Could not parse Request Batch")]
|
||||
#[error("Could not parse Request Batch")]
|
||||
InvalidBatch,
|
||||
#[fail(display = "Could not parse Content ID")]
|
||||
#[error("Could not parse Content ID")]
|
||||
InvalidContentId,
|
||||
#[fail(display = "Could not access Filestore for reads")]
|
||||
#[error("Could not access Filestore for reads")]
|
||||
FilestoreReadFailure,
|
||||
#[fail(display = "Could not access Filestore for writes")]
|
||||
#[error("Could not access Filestore for writes")]
|
||||
FilestoreWriteFailure,
|
||||
#[fail(display = "Failed to create response")]
|
||||
#[error("Failed to create response")]
|
||||
ResponseCreationFailure,
|
||||
}
|
||||
|
@ -8,36 +8,36 @@
|
||||
|
||||
use crate::part_header::{PartHeader, PartHeaderType};
|
||||
|
||||
use failure_ext::Fail;
|
||||
pub use failure_ext::{Error, Result, ResultExt};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "bundle2 decode error: {}", _0)]
|
||||
#[error("bundle2 decode error: {0}")]
|
||||
Bundle2Decode(String),
|
||||
#[fail(display = "changegroup decode error: {}", _0)]
|
||||
#[error("changegroup decode error: {0}")]
|
||||
CgDecode(String),
|
||||
#[fail(display = "changegroup2 encode error: {}", _0)]
|
||||
#[error("changegroup2 encode error: {0}")]
|
||||
Cg2Encode(String),
|
||||
#[fail(display = "wirepack decode error: {}", _0)]
|
||||
#[error("wirepack decode error: {0}")]
|
||||
WirePackDecode(String),
|
||||
#[fail(display = "wirepack encode error: {}", _0)]
|
||||
#[error("wirepack encode error: {0}")]
|
||||
WirePackEncode(String),
|
||||
#[fail(display = "bundle2 encode error: {}", _0)]
|
||||
#[error("bundle2 encode error: {0}")]
|
||||
Bundle2Encode(String),
|
||||
#[fail(display = "bundle2 chunk error: {}", _0)]
|
||||
#[error("bundle2 chunk error: {0}")]
|
||||
Bundle2Chunk(String),
|
||||
#[fail(display = "invalid delta: {}", _0)]
|
||||
#[error("invalid delta: {0}")]
|
||||
InvalidDelta(String),
|
||||
#[fail(display = "invalid wire pack entry: {}", _0)]
|
||||
#[error("invalid wire pack entry: {0}")]
|
||||
InvalidWirePackEntry(String),
|
||||
#[fail(display = "unknown part type: {:?}", _0)]
|
||||
#[error("unknown part type: {0:?}")]
|
||||
BundleUnknownPart(PartHeader),
|
||||
#[fail(display = "unknown params for bundle2 part '{:?}': {:?}", _0, _1)]
|
||||
#[error("unknown params for bundle2 part '{0:?}': {1:?}")]
|
||||
BundleUnknownPartParams(PartHeaderType, Vec<String>),
|
||||
#[fail(display = "error while generating listkey part")]
|
||||
#[error("error while generating listkey part")]
|
||||
ListkeyGeneration,
|
||||
#[fail(display = "error while generating phase-heads part")]
|
||||
#[error("error while generating phase-heads part")]
|
||||
PhaseHeadsGeneration,
|
||||
}
|
||||
|
||||
|
@ -6,22 +6,21 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
pub use failure_ext::{
|
||||
bail_msg, ensure_msg, format_err, prelude::*, Error, Fail, Result, ResultExt,
|
||||
};
|
||||
pub use failure_ext::{bail_msg, ensure_msg, format_err, prelude::*, Error, Result, ResultExt};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "Bundle2Decode: {}", _0)]
|
||||
#[error("Bundle2Decode: {0}")]
|
||||
Bundle2Decode(String),
|
||||
#[fail(display = "Revlog: {}", _0)]
|
||||
#[error("Revlog: {0}")]
|
||||
Revlog(String),
|
||||
#[fail(display = "Repo: {}", _0)]
|
||||
#[error("Repo: {0}")]
|
||||
Repo(String),
|
||||
#[fail(display = "Path: {}", _0)]
|
||||
#[error("Path: {0}")]
|
||||
Path(String),
|
||||
#[fail(display = "Unknown requirement: {}", _0)]
|
||||
#[error("Unknown requirement: {0}")]
|
||||
UnknownReq(String),
|
||||
#[fail(display = "invalid Thrift structure '{}': {}", _0, _1)]
|
||||
#[error("invalid Thrift structure '{0}': {1}")]
|
||||
InvalidThrift(String, String),
|
||||
}
|
||||
|
@ -12,18 +12,19 @@ use std::io::{self, BufRead, BufReader, Read};
|
||||
use std::path::PathBuf;
|
||||
|
||||
use ascii::AsciiStr;
|
||||
use failure_ext::{bail_err, chain::*, Error, Fail, Result};
|
||||
use failure_ext::{bail_err, chain::*, Error, Result};
|
||||
use futures::future;
|
||||
use futures::stream::{self, Stream};
|
||||
use futures_ext::{BoxFuture, BoxStream, StreamExt};
|
||||
use thiserror::Error;
|
||||
|
||||
use mercurial_types::HgChangesetId;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "invalid bookmarks line: {}", _0)]
|
||||
#[error("invalid bookmarks line: {0}")]
|
||||
InvalidBookmarkLine(String),
|
||||
#[fail(display = "invalid hash: {}", _0)]
|
||||
#[error("invalid hash: {0}")]
|
||||
InvalidHash(String),
|
||||
}
|
||||
|
||||
|
@ -6,14 +6,15 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
pub use failure_ext::{Error, Fail, Result};
|
||||
pub use failure_ext::{Error, Result};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "invalid manifest description: {}", _0)]
|
||||
#[error("invalid manifest description: {0}")]
|
||||
InvalidManifestDescription(String),
|
||||
#[fail(display = "invalid path map: {}", _0)]
|
||||
#[error("invalid path map: {0}")]
|
||||
InvalidPathMap(String),
|
||||
#[fail(display = "invalid directory hash map: {}", _0)]
|
||||
#[error("invalid directory hash map: {0}")]
|
||||
InvalidDirectoryHashes(String),
|
||||
}
|
||||
|
@ -7,35 +7,26 @@
|
||||
*/
|
||||
|
||||
use crate::{HgFileNodeId, HgNodeHash, Type};
|
||||
use failure::Fail;
|
||||
use mononoke_types::{ContentId, RepoPath};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "Corrupt hg filenode returned: {} != {}", _0, _1)]
|
||||
#[error("Corrupt hg filenode returned: {expected} != {actual}")]
|
||||
CorruptHgFileNode {
|
||||
expected: HgFileNodeId,
|
||||
actual: HgFileNodeId,
|
||||
},
|
||||
#[fail(display = "Content blob missing for id: {}", _0)]
|
||||
#[error("Content blob missing for id: {0}")]
|
||||
ContentBlobMissing(ContentId),
|
||||
#[fail(display = "Mercurial content missing for node {} (type {})", _0, _1)]
|
||||
#[error("Mercurial content missing for node {0} (type {1})")]
|
||||
HgContentMissing(HgNodeHash, Type),
|
||||
#[fail(
|
||||
display = "Error while deserializing file node retrieved from key '{}'",
|
||||
_0
|
||||
)]
|
||||
#[error("Error while deserializing file node retrieved from key '{0}'")]
|
||||
FileNodeDeserializeFailed(String),
|
||||
#[fail(
|
||||
display = "Error while deserializing manifest retrieved from key '{}'",
|
||||
_0
|
||||
)]
|
||||
#[error("Error while deserializing manifest retrieved from key '{0}'")]
|
||||
ManifestDeserializeFailed(String),
|
||||
#[fail(display = "Incorrect LFS file content {}", _0)]
|
||||
#[error("Incorrect LFS file content {0}")]
|
||||
IncorrectLfsFileContent(String),
|
||||
#[fail(
|
||||
display = "Inconsistent node hash for entry: path {}, provided: {}, computed: {}",
|
||||
_0, _1, _2
|
||||
)]
|
||||
#[error("Inconsistent node hash for entry: path {0}, provided: {1}, computed: {2}")]
|
||||
InconsistentEntryHash(RepoPath, HgNodeHash, HgNodeHash),
|
||||
}
|
||||
|
@ -6,20 +6,20 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
pub use failure::Fail;
|
||||
pub use failure_ext::{Error, ResultExt};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "invalid sha-1 input: {}", _0)]
|
||||
#[error("invalid sha-1 input: {0}")]
|
||||
InvalidSha1Input(String),
|
||||
#[fail(display = "invalid fragment list: {}", _0)]
|
||||
#[error("invalid fragment list: {0}")]
|
||||
InvalidFragmentList(String),
|
||||
#[fail(display = "invalid Thrift structure '{}': {}", _0, _1)]
|
||||
#[error("invalid Thrift structure '{0}': {1}")]
|
||||
InvalidThrift(String, String),
|
||||
#[fail(display = "error while deserializing blob for '{}'", _0)]
|
||||
#[error("error while deserializing blob for '{0}'")]
|
||||
BlobDeserializeError(String),
|
||||
#[fail(display = "imposssible to parse unknown rev flags")]
|
||||
#[error("imposssible to parse unknown rev flags")]
|
||||
UnknownRevFlags,
|
||||
}
|
||||
|
||||
|
@ -8,32 +8,32 @@
|
||||
|
||||
//! Definition of errors used in this crate by the error_chain crate
|
||||
|
||||
use failure_ext::failure_derive::Fail;
|
||||
pub use failure_ext::{Error, Result};
|
||||
use mononoke_types::RepositoryId;
|
||||
use thiserror::Error;
|
||||
|
||||
/// Types of errors we can raise
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
/// The given bookmark does not exist in the repo
|
||||
#[fail(display = "bookmark not found: {}", _0)]
|
||||
#[error("bookmark not found: {0}")]
|
||||
BookmarkNotFound(String),
|
||||
/// The structure of metaconfig repo is invalid
|
||||
#[fail(display = "invalid file structure: {}", _0)]
|
||||
#[error("invalid file structure: {0}")]
|
||||
InvalidFileStructure(String),
|
||||
/// Config is invalid
|
||||
#[fail(display = "invalid config options: {}", _0)]
|
||||
#[error("invalid config options: {0}")]
|
||||
InvalidConfig(String),
|
||||
/// Duplicated repo ids
|
||||
#[fail(display = "repoid {} used more than once", _0)]
|
||||
#[error("repoid {0} used more than once")]
|
||||
DuplicatedRepoId(RepositoryId),
|
||||
/// Missing path for hook
|
||||
#[fail(display = "missing path")]
|
||||
#[error("missing path")]
|
||||
MissingPath(),
|
||||
/// Invalid pushvar
|
||||
#[fail(display = "invalid pushvar, should be KEY=VALUE: {}", _0)]
|
||||
#[error("invalid pushvar, should be KEY=VALUE: {0}")]
|
||||
InvalidPushvar(String),
|
||||
/// Too many bypass options for a hook
|
||||
#[fail(display = "Only one bypass option is allowed. Hook: {}", _0)]
|
||||
#[error("Only one bypass option is allowed. Hook: {0}")]
|
||||
TooManyBypassOptions(String),
|
||||
}
|
||||
|
@ -11,8 +11,6 @@
|
||||
#![deny(missing_docs)]
|
||||
#![deny(warnings)]
|
||||
|
||||
use failure_ext as failure;
|
||||
|
||||
pub mod errors;
|
||||
pub mod repoconfig;
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
use failure::Error;
|
||||
use futures::{future, Future};
|
||||
use futures_ext::FutureExt;
|
||||
use thiserror::Error;
|
||||
|
||||
use blobrepo::BlobRepo;
|
||||
use cloned::cloned;
|
||||
@ -17,11 +18,9 @@ use mercurial_types::manifest::Content;
|
||||
use mercurial_types::{Changeset, HgChangesetId};
|
||||
use mononoke_types::MPath;
|
||||
|
||||
use failure::Fail;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "{} not found", _0)]
|
||||
#[error("{0} not found")]
|
||||
NotFound(String),
|
||||
}
|
||||
|
||||
|
@ -13,11 +13,12 @@ use crate::{
|
||||
};
|
||||
use blobstore::{Blobstore, BlobstoreBytes, Loadable, LoadableError};
|
||||
use context::CoreContext;
|
||||
use failure::{err_msg, format_err, Error, Fail};
|
||||
use failure::{err_msg, format_err, Error};
|
||||
use fbthrift::compact_protocol;
|
||||
use futures::Future;
|
||||
use futures_ext::{BoxFuture, FutureExt};
|
||||
use std::{collections::HashMap, convert::TryFrom};
|
||||
use thiserror::Error;
|
||||
use xdiff::{diff_hunks, Hunk};
|
||||
|
||||
#[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)]
|
||||
@ -81,11 +82,11 @@ pub fn store_blame<B: Blobstore + Clone>(
|
||||
.map(move |_| blame_id)
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash, Fail)]
|
||||
#[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash, Error)]
|
||||
pub enum BlameRejected {
|
||||
#[fail(display = "Blame was not generated because file was too big")]
|
||||
#[error("Blame was not generated because file was too big")]
|
||||
TooBig,
|
||||
#[fail(display = "Blame was not generated because file was marked as binary")]
|
||||
#[error("Blame was not generated because file was marked as binary")]
|
||||
Binary,
|
||||
}
|
||||
|
||||
|
@ -7,36 +7,34 @@
|
||||
*/
|
||||
|
||||
use crate::path::MPath;
|
||||
pub use failure_ext::{Error, Fail, ResultExt};
|
||||
pub use failure_ext::{Error, ResultExt};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "invalid blake2 input: {}", _0)]
|
||||
#[error("invalid blake2 input: {0}")]
|
||||
InvalidBlake2Input(String),
|
||||
#[fail(display = "invalid sha1 input: {}", _0)]
|
||||
#[error("invalid sha1 input: {0}")]
|
||||
InvalidSha1Input(String),
|
||||
#[fail(display = "invalid sha256 input: {}", _0)]
|
||||
#[error("invalid sha256 input: {0}")]
|
||||
InvalidSha256Input(String),
|
||||
#[fail(display = "invalid git sha1 input: {}", _0)]
|
||||
#[error("invalid git sha1 input: {0}")]
|
||||
InvalidGitSha1Input(String),
|
||||
#[fail(display = "invalid path '{}': {}", _0, _1)]
|
||||
#[error("invalid path '{0}': {1}")]
|
||||
InvalidPath(String, String),
|
||||
#[fail(display = "invalid Mononoke path '{}': {}", _0, _1)]
|
||||
#[error("invalid Mononoke path '{0}': {1}")]
|
||||
InvalidMPath(MPath, String),
|
||||
#[fail(display = "error while deserializing blob for '{}'", _0)]
|
||||
#[error("error while deserializing blob for '{0}'")]
|
||||
BlobDeserializeError(String),
|
||||
#[fail(display = "invalid Thrift structure '{}': {}", _0, _1)]
|
||||
#[error("invalid Thrift structure '{0}': {1}")]
|
||||
InvalidThrift(String, String),
|
||||
#[fail(display = "invalid changeset date: {}", _0)]
|
||||
#[error("invalid changeset date: {0}")]
|
||||
InvalidDateTime(String),
|
||||
#[fail(
|
||||
display = "not path-conflict-free: changed path '{}' is a prefix of '{}'",
|
||||
_0, _1
|
||||
)]
|
||||
#[error("not path-conflict-free: changed path '{0}' is a prefix of '{1}'")]
|
||||
NotPathConflictFree(MPath, MPath),
|
||||
#[fail(display = "invalid bonsai changeset: {}", _0)]
|
||||
#[error("invalid bonsai changeset: {0}")]
|
||||
InvalidBonsaiChangeset(String),
|
||||
#[fail(display = "Failed to parse RepositoryId from '{}'", _0)]
|
||||
#[error("Failed to parse RepositoryId from '{0}'")]
|
||||
FailedToParseRepositoryId(String),
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# @autocargo from //common/rust/netstring:netstring
|
||||
# Signature<<99e6fa71cb31dfc8e9eceec72b7968693d33f01e>>
|
||||
# Signature<<0e16a7ecf7106e41d1f700f98f675d5ee574d48e>>
|
||||
[package]
|
||||
name = "netstring"
|
||||
edition = "2018"
|
||||
@ -10,8 +10,9 @@ include = ["src/**/*.rs"]
|
||||
[dependencies]
|
||||
failure_ext = { path = "../failure_ext" }
|
||||
bytes = { version="*", features=["serde"] }
|
||||
thiserror = "*"
|
||||
tokio-io = "0.1"
|
||||
|
||||
[dev-dependencies]
|
||||
quickcheck = "0.9"
|
||||
# @end of Signature<<99e6fa71cb31dfc8e9eceec72b7968693d33f01e>>
|
||||
# @end of Signature<<0e16a7ecf7106e41d1f700f98f675d5ee574d48e>>
|
||||
|
@ -20,11 +20,12 @@
|
||||
use failure_ext as failure;
|
||||
|
||||
mod errors {
|
||||
pub use crate::failure::{Error, Fail, Result};
|
||||
pub use crate::failure::{Error, Result};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Clone, Debug, Fail)]
|
||||
#[derive(Clone, Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "{}", _0)]
|
||||
#[error("{0}")]
|
||||
NetstringDecode(&'static str),
|
||||
}
|
||||
}
|
||||
|
@ -6,11 +6,11 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use failure::Fail;
|
||||
pub use failure_ext::{Error, Result};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Eq, Fail, PartialEq)]
|
||||
#[derive(Debug, Eq, Error, PartialEq)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "failed to get/set phase, reason: {}", _0)]
|
||||
#[error("failed to get/set phase, reason: {0}")]
|
||||
PhasesError(String),
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ use bonsai_utils::{bonsai_diff, BonsaiDiffResult};
|
||||
use bookmarks::{BookmarkName, BookmarkUpdateReason, BundleReplayData};
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure::{Error, Fail};
|
||||
use failure::Error;
|
||||
use failure_ext::{FutureFailureErrorExt, Result};
|
||||
use futures::future::{err, join_all, loop_fn, ok, Loop};
|
||||
use futures::{stream, Future, IntoFuture, Stream};
|
||||
@ -70,6 +70,7 @@ use slog::info;
|
||||
use std::cmp::{max, Ordering};
|
||||
use std::collections::{BTreeMap, HashMap, HashSet, VecDeque};
|
||||
use std::iter::FromIterator;
|
||||
use thiserror::Error;
|
||||
use tracing::{trace_args, Traced};
|
||||
|
||||
const MAX_REBASE_ATTEMPTS: usize = 100;
|
||||
@ -77,34 +78,25 @@ const MAX_REBASE_ATTEMPTS: usize = 100;
|
||||
pub const MUTATION_KEYS: &[&str] = &["mutpred", "mutuser", "mutdate", "mutop", "mutsplit"];
|
||||
|
||||
// TODO: (torozco) T44843329 Why does this duplicate scm/mononoke/bundle2_resolver/src/errors.rs?
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "Bonsai not found for hg changeset: {:?}", _0)]
|
||||
#[error("Bonsai not found for hg changeset: {0:?}")]
|
||||
BonsaiNotFoundForHgChangeset(HgChangesetId),
|
||||
#[fail(display = "Pushrebase onto bookmark not found: {:?}", _0)]
|
||||
#[error("Pushrebase onto bookmark not found: {0:?}")]
|
||||
PushrebaseBookmarkNotFound(BookmarkName),
|
||||
#[fail(display = "Only one head is allowed in pushed set")]
|
||||
#[error("Only one head is allowed in pushed set")]
|
||||
PushrebaseTooManyHeads,
|
||||
#[fail(
|
||||
display = "Error while uploading data for changesets, hashes: {:?}",
|
||||
_0
|
||||
)]
|
||||
#[error("Error while uploading data for changesets, hashes: {0:?}")]
|
||||
PushrebaseNoCommonRoot(BookmarkName, HashSet<ChangesetId>),
|
||||
#[fail(display = "Internal error: root changeset {} not found", _0)]
|
||||
#[error("Internal error: root changeset {0} not found")]
|
||||
RootNotFound(ChangesetId),
|
||||
#[fail(display = "No pushrebase roots found")]
|
||||
#[error("No pushrebase roots found")]
|
||||
NoRoots,
|
||||
#[fail(display = "Pushrebase failed after too many unsuccessful rebases")]
|
||||
#[error("Pushrebase failed after too many unsuccessful rebases")]
|
||||
TooManyRebaseAttempts,
|
||||
#[fail(
|
||||
display = "Forbid pushrebase because root ({}) is not a p1 of {} bookmark",
|
||||
_0, _1
|
||||
)]
|
||||
#[error("Forbid pushrebase because root ({0}) is not a p1 of {1} bookmark")]
|
||||
P2RootRebaseForbidden(HgChangesetId, BookmarkName),
|
||||
#[fail(
|
||||
display = "internal error: unexpected file conflicts when adding new file changes to {}",
|
||||
_0
|
||||
)]
|
||||
#[error("internal error: unexpected file conflicts when adding new file changes to {0}")]
|
||||
NewFileChangesConflict(ChangesetId),
|
||||
}
|
||||
|
||||
|
@ -8,32 +8,27 @@
|
||||
|
||||
use std::collections::HashSet;
|
||||
|
||||
pub use failure_ext::{prelude::*, Fail};
|
||||
pub use failure_ext::prelude::*;
|
||||
use thiserror::Error;
|
||||
|
||||
use bookmarks::BookmarkName;
|
||||
use mercurial_types::HgChangesetId;
|
||||
use mononoke_types::ChangesetId;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "Bonsai not found for hg changeset: {:?}", _0)]
|
||||
#[error("Bonsai not found for hg changeset: {0:?}")]
|
||||
BonsaiNotFoundForHgChangeset(HgChangesetId),
|
||||
#[fail(display = "Malformed treemanifest part: {}", _0)]
|
||||
#[error("Malformed treemanifest part: {0}")]
|
||||
MalformedTreemanifestPart(String),
|
||||
#[fail(display = "Pushrebase onto bookmark not found: {:?}", _0)]
|
||||
#[error("Pushrebase onto bookmark not found: {0:?}")]
|
||||
PushrebaseBookmarkNotFound(BookmarkName),
|
||||
#[fail(display = "Only one head is allowed in pushed set")]
|
||||
#[error("Only one head is allowed in pushed set")]
|
||||
PushrebaseTooManyHeads,
|
||||
#[fail(
|
||||
display = "Error while uploading data for changesets, hashes: {:?}",
|
||||
_0
|
||||
)]
|
||||
#[error("Error while uploading data for changesets, hashes: {0:?}")]
|
||||
WhileUploadingData(Vec<HgChangesetId>),
|
||||
#[fail(
|
||||
display = "No common root found between: bookmark:{:?} roots:{:?}",
|
||||
_0, _1
|
||||
)]
|
||||
#[error("No common root found between: bookmark:{0:?} roots:{1:?}")]
|
||||
PushrebaseNoCommonRoot(BookmarkName, HashSet<ChangesetId>),
|
||||
#[fail(display = "Repo is marked as read-only: {}", _0)]
|
||||
#[error("Repo is marked as read-only: {0}")]
|
||||
RepoReadOnly(String),
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ use blobrepo::{file_history::get_file_history, BlobRepo};
|
||||
use bytes::Bytes;
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure::{Error, Fail, Fallible as Result};
|
||||
use failure::{Error, Fallible as Result};
|
||||
use futures::{Future, IntoFuture, Stream};
|
||||
use futures_ext::{select_all, BoxFuture, FutureExt};
|
||||
use mercurial_types::{
|
||||
@ -27,21 +27,22 @@ use mercurial_types::{
|
||||
HgFileNodeId, HgParents, MPath, RevFlags,
|
||||
};
|
||||
use revisionstore::Metadata;
|
||||
use thiserror::Error;
|
||||
|
||||
use redaction::RedactionFutureExt;
|
||||
|
||||
const METAKEYFLAG: &str = "f";
|
||||
const METAKEYSIZE: &str = "s";
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "Corrupt hg filenode returned: {} != {}", _0, _1)]
|
||||
#[error("Corrupt hg filenode returned: {expected} != {actual}")]
|
||||
CorruptHgFileNode {
|
||||
expected: HgFileNodeId,
|
||||
actual: HgFileNodeId,
|
||||
},
|
||||
|
||||
#[fail(display = "Invalid blob kind returned: {:?}", _0)]
|
||||
#[error("Invalid blob kind returned: {kind:?}")]
|
||||
InvalidKind { kind: RemotefilelogBlobKind },
|
||||
}
|
||||
|
||||
|
@ -6,24 +6,22 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
pub use failure_ext::{Error, Fail, Result, ResultExt};
|
||||
pub use failure_ext::{Error, Result, ResultExt};
|
||||
use thiserror::Error;
|
||||
|
||||
use mercurial_types::HgChangesetId;
|
||||
use mercurial_types::{HgNodeHash, RepoPath};
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(
|
||||
display = "Data corruption for {}: expected {}, actual {}!",
|
||||
_0, _1, _2
|
||||
)]
|
||||
#[error("Data corruption for {path}: expected {expected}, actual {actual}!")]
|
||||
DataCorruption {
|
||||
path: RepoPath,
|
||||
expected: HgNodeHash,
|
||||
actual: HgNodeHash,
|
||||
},
|
||||
#[fail(display = "Request {} was throttled", _0)]
|
||||
#[error("Request {request_name} was throttled")]
|
||||
RequestThrottled { request_name: String },
|
||||
#[fail(display = "Bonsai not found for hg changeset: {:?}", _0)]
|
||||
#[error("Bonsai not found for hg changeset: {0:?}")]
|
||||
BonsaiNotFoundForHgChangeset(HgChangesetId),
|
||||
}
|
||||
|
@ -11,19 +11,20 @@
|
||||
use std::vec::Vec;
|
||||
|
||||
use bytes::Bytes;
|
||||
use failure::{Error, Fail};
|
||||
use failure::Error;
|
||||
use futures::Future;
|
||||
use futures_ext::{BoxFuture, FutureExt};
|
||||
use sql::{queries, Connection};
|
||||
use sql_ext::SqlConstructors;
|
||||
use thiserror::Error;
|
||||
|
||||
use blobstore::Blobstore;
|
||||
use context::CoreContext;
|
||||
use mononoke_types::{BlobstoreBytes, RepositoryId};
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "internal error: streaming blob {} missing", _0)]
|
||||
#[error("internal error: streaming blob {0} missing")]
|
||||
MissingStreamingBlob(String),
|
||||
}
|
||||
|
||||
|
@ -10,18 +10,19 @@ use std::fmt::Debug;
|
||||
use std::mem;
|
||||
|
||||
use bytes::Bytes;
|
||||
use failure::{Error, Fail};
|
||||
use failure::Error;
|
||||
use failure_ext::Result;
|
||||
use futures::{Poll, Stream};
|
||||
use thiserror::Error;
|
||||
|
||||
use mercurial_bundles::wirepack::converter::{WirePackConverter, WirePackPartProcessor};
|
||||
use mercurial_bundles::wirepack::{DataEntry, HistoryEntry, Part};
|
||||
use mercurial_revlog::manifest::ManifestContent;
|
||||
use mercurial_types::{delta, HgNodeHash, HgNodeKey, RepoPath, NULL_HASH};
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "Malformed treemanifest part: {}", _0)]
|
||||
#[error("Malformed treemanifest part: {0}")]
|
||||
MalformedTreemanifestPart(String),
|
||||
}
|
||||
|
||||
|
@ -6,22 +6,22 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use failure::Fail;
|
||||
pub use failure_ext::{Error, Result};
|
||||
use thiserror::Error;
|
||||
|
||||
use mercurial_types::{HgChangesetId, HgNodeHash};
|
||||
use mononoke_types::ChangesetId;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "repo error checking for node: {}", _0)]
|
||||
#[error("repo error checking for node: {0}")]
|
||||
RepoNodeError(HgNodeHash),
|
||||
#[fail(display = "repo error checking for changeset: {}", _0)]
|
||||
#[error("repo error checking for changeset: {0}")]
|
||||
RepoChangesetError(ChangesetId),
|
||||
#[fail(display = "could not fetch node generation")]
|
||||
#[error("could not fetch node generation")]
|
||||
GenerationFetchFailed,
|
||||
#[fail(display = "failed to fetch parent nodes")]
|
||||
#[error("failed to fetch parent nodes")]
|
||||
ParentsFetchFailed,
|
||||
#[fail(display = "Bonsai mapping not found for {}", _0)]
|
||||
#[error("Bonsai mapping not found for {0}")]
|
||||
BonsaiMappingNotFound(HgChangesetId),
|
||||
}
|
||||
|
@ -6,24 +6,24 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use failure::Fail;
|
||||
pub use failure_ext::{Error, Result, ResultExt};
|
||||
use mononoke_types::RepositoryId;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ErrorKind {
|
||||
#[fail(display = "connection does not start with preamble")]
|
||||
#[error("connection does not start with preamble")]
|
||||
NoConnectionPreamble,
|
||||
#[fail(display = "connection error while reading preamble")]
|
||||
#[error("connection error while reading preamble")]
|
||||
ConnectionError,
|
||||
#[fail(display = "connection does not have a client certificate")]
|
||||
#[error("connection does not have a client certificate")]
|
||||
ConnectionNoClientCertificate,
|
||||
#[fail(display = "Unauthorized access, permission denied")]
|
||||
#[error("Unauthorized access, permission denied")]
|
||||
AuthorizationFailed,
|
||||
#[fail(display = "Failed to create AclChecker for tier {}", _0)]
|
||||
#[error("Failed to create AclChecker for tier {0}")]
|
||||
AclCheckerCreationFailed(String),
|
||||
#[fail(display = "Unexpected identity type {}", _0)]
|
||||
#[error("Unexpected identity type {0}")]
|
||||
UnexpectedIdentityType(String),
|
||||
#[fail(display = "Large repo not found: {}", _0)]
|
||||
#[error("Large repo not found: {0}")]
|
||||
LargeRepoNotFound(RepositoryId),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user