@hasura/ndc-sdk-typescript
Version:
This SDK is mostly analogous to the Rust SDK, except where necessary.
37 lines • 3.8 kB
TypeScript
import { ErrorResponse } from "./schema";
type ErrorCode = /** Bad Request - The request did not match the data connector's expectation based on this specification. */ 400 | /** Forbidden - The request could not be handled because a permission check failed - for example, a mutation might fail because a check constraint was not met.*/ 403 | /** Conflict - The request could not be handled because it would create a conflicting state for the data source - for example, a mutation might fail because a foreign key constraint was not met.*/ 409 | /** Unprocessable Content - The request could not be handled because, while the request was well-formed, it was not semantically correct. For example, a value for a custom scalar type was provided, but with an incorrect type.*/ 422 | /** Internal Server Error - The request could not be handled because of an error on the server */ 500 | /** Not Supported - The request could not be handled because it relies on an unsupported capability. Note: this ought to indicate an error on the caller side, since the caller should not generate requests which are incompatible with the indicated capabilities. */ 501 | /** Bad Gateway - The request could not be handled because an upstream service was unavailable or returned an unexpected response, e.g., a connection to a database server failed. */ 502 | number;
export declare class ConnectorError extends Error {
statusCode: ErrorCode;
details?: ErrorResponse["details"];
constructor(statusCode: ErrorCode, message: ErrorResponse["message"], details?: ErrorResponse["details"]);
}
/** The request did not match the data connector's expectation based on this specification */
export declare class BadRequest extends ConnectorError {
constructor(message: ErrorResponse["message"], details?: ErrorResponse["details"]);
}
/** The request could not be handled because a permission check failed - for example, a mutation might fail because a check constraint was not met */
export declare class Forbidden extends ConnectorError {
constructor(message: ErrorResponse["message"], details?: ErrorResponse["details"]);
}
/** The request could not be handled because it would create a conflicting state for the data source - for example, a mutation might fail because a foreign key constraint was not met */
export declare class Conflict extends ConnectorError {
constructor(message: ErrorResponse["message"], details?: ErrorResponse["details"]);
}
/** The request could not be handled because, while the request was well-formed, it was not semantically correct. For example, a value for a custom scalar type was provided, but with an incorrect type */
export declare class UnprocessableContent extends ConnectorError {
constructor(message: ErrorResponse["message"], details?: ErrorResponse["details"]);
}
/** The request could not be handled because of an error on the server */
export declare class InternalServerError extends ConnectorError {
constructor(message: ErrorResponse["message"], details?: ErrorResponse["details"]);
}
/** The request could not be handled because it relies on an unsupported capability. Note: this ought to indicate an error on the caller side, since the caller should not generate requests which are incompatible with the indicated capabilities */
export declare class NotSupported extends ConnectorError {
constructor(message: ErrorResponse["message"], details?: ErrorResponse["details"]);
}
/** The request could not be handled because an upstream service was unavailable or returned an unexpected response, e.g., a connection to a database server failed */
export declare class BadGateway extends ConnectorError {
constructor(message: ErrorResponse["message"], details?: ErrorResponse["details"]);
}
export {};
//# sourceMappingURL=error.d.ts.map