error codes for schema

This commit is contained in:
mpostma 2020-05-26 12:17:53 +02:00
parent 9c58ca7ce5
commit e2546f2646
2 changed files with 10 additions and 3 deletions

View file

@ -26,7 +26,12 @@ impl error::Error for Error {}
impl ErrorCode for Error {
fn error_code(&self) -> Code {
// TODO populate with correct error codes
Code::Internal
use Error::*;
match self {
FieldNameNotFound(_) => Code::Internal,
MaxFieldsLimitExceeded => Code::MaxFieldsLimitExceeded,
PrimaryKeyAlreadyPresent => Code::PrimaryKeyAlreadyPresent,
}
}
}