import { ActionProcessor , Connection } from ".." ; const namespace = "errors" ; declare module ".." { export interface ActionheroConfigInterface { [ namespace ] : ReturnType < typeof DEFAULT [ typeof namespace ] > ; } } export const DEFAULT = { [ namespace ] : ( ) => { return { _toExpand : false , reportUnknownActions : false , serializers : { servers : { web : ( error ) => { if ( error . message ) { return String ( error . message ) ; } else { return error ; } } , websocket : ( error ) => { if ( error . message ) { return String ( error . message ) ; } else { return error ; } } , specHelper : ( error ) => { if ( error . message ) { return "Error: " + String ( error . message ) ; } else { return error ; } } , } , actionProcessor : null as ActionProcessor < any > [ "applyDefaultErrorLogLineFormat" ] , } , invalidParams : ( data , validationErrors ) => { if ( validationErrors . length >= 0 ) return validationErrors [ 0 ] ; return "validation error" ; } , missingParams : ( data , missingParams ) => { return `${ missingParams [ 0 ] } is a required parameter for this action` ; } , unknownAction : ( data ) => { return `unknown action or invalid apiVersion` ; } , unsupportedServerType : ( data ) => { return `this action does not support the ${ data . connection . type } connection type` ; } , serverShuttingDown : ( data ) => { return `the server is shutting down` ; } , tooManyPendingActions : ( data ) => { return `you have too many pending requests` ; } , async genericError ( data , error ) { return error ; } , fileNotFound : ( connection ) => { return `that file is not found` ; } , fileNotProvided : ( connection ) => { return `file is a required param to send a file` ; } , fileReadError : ( connection , error ) => { return `error reading file: ${ error ?. message ?? error }` ; } , verbNotFound : ( connection , verb ) => { return `verb not found or not allowed (${ verb })` ; } , verbNotAllowed : ( connection , verb ) => { return `verb not found or not allowed (${ verb })` ; } , connectionRoomAndMessage : ( connection ) => { return `both room and message are required` ; } , connectionNotInRoom : ( connection , room ) => { return `connection not in this room (${ room })` ; } , connectionAlreadyInRoom : ( connection , room ) => { return `connection already in this room (${ room })` ; } , connectionRoomHasBeenDeleted : ( room ) => { return "this room has been deleted" ; } , connectionRoomNotExist : ( room ) => { return "room does not exist" ; } , connectionRoomExists : ( room ) => { return "room exists" ; } , connectionRoomRequired : ( ) => { return "a room is required" ; } , } ; } , } ;