@crypto-connect/errors
v0.0.2-alpha.55
Published
CryptoConnect custom errors
Downloads
3
Readme
CryptoConnect Errors
import {
UndocumentedResultError,
CryptoConnectError,
NoCredentialsError,
NotAuthorizedError,
ServerError,
} from "@crypto-connect/errors";
try {
// Do something with Crypto Connect
// ...
} catch (err) {
if (err instanceof CryptoConnectError) {
// All custom errors
}
if (err instanceof UndocumentedResultError) {
// API response doesn't match CryptoConnect's expectations
}
if (err instanceof NoCredentialsError) {
// Methods that requires authorization has been called before
// credentials have been provided
}
if (err instanceof NotAuthorizedError) {
// Credentials have been supplied but are not sufficient to authorize
// the request
}
if (err instanceof ServerError) {
// Server responded with a non-200 status
}
}