@energica-city/shared-amplify-utils
Version:
Shared utilities for AWS Amplify projects
12 lines • 807 B
TypeScript
import type { Middleware } from '../middlewareChain';
import type { RestResponse, RestInputWithModels, RestErrorHandlerConfig } from './types';
import type { AmplifyModelType } from '../../queries/types';
/**
* Creates REST error handler middleware
*
* Creates a middleware function that catches and processes all errors
* in the middleware chain, converting them to appropriate HTTP responses.
* Uses REST error code mapping for graceful error handling.
*/
export declare function createRestErrorHandler<TTypes extends Record<string, AmplifyModelType> = Record<string, AmplifyModelType>, TSelected extends keyof TTypes = keyof TTypes, TOutput = RestResponse>(config?: RestErrorHandlerConfig): Middleware<RestInputWithModels<TTypes, TSelected>, TOutput>;
//# sourceMappingURL=RestErrorHandler.d.ts.map