UNPKG

@devtion/backend

Version:
76 lines 4.11 kB
import * as functions from "firebase-functions"; import { FunctionsErrorCode, HttpsError } from "firebase-functions/v1/https"; import { LogLevel } from "../types/enums"; /** * Create a new custom HTTPs error for cloud functions. * @notice the set of Firebase Functions status codes. The codes are the same at the * ones exposed by {@link https://github.com/grpc/grpc/blob/master/doc/statuscodes.md | gRPC}. * @param errorCode <FunctionsErrorCode> - the set of possible error codes. * @param message <string> - the error message. * @param [details] <string> - the details of the error (optional). * @returns <HttpsError> */ export declare const makeError: (errorCode: FunctionsErrorCode, message: string, details?: string) => HttpsError; /** * Log a custom message on console using a specific level. * @param message <string> - the message to be shown. * @param logLevel <LogLevel> - the level of the log to be used to show the message (e.g., debug, error). */ export declare const printLog: (message: string, logLevel: LogLevel) => void; /** * Log and throw an HTTPs error. * @param error <HttpsError> - the error to be logged and thrown. */ export declare const logAndThrowError: (error: HttpsError) => never; /** * A set of Cloud Function specific errors. * @notice these are errors that happen only on specific cloud functions. */ export declare const SPECIFIC_ERRORS: { SE_AUTH_NO_CURRENT_AUTH_USER: functions.auth.HttpsError; SE_AUTH_SET_CUSTOM_USER_CLAIMS_FAIL: functions.auth.HttpsError; SE_AUTH_USER_NOT_REPUTABLE: functions.auth.HttpsError; SE_STORAGE_INVALID_BUCKET_NAME: functions.auth.HttpsError; SE_STORAGE_TOO_MANY_BUCKETS: functions.auth.HttpsError; SE_STORAGE_MISSING_PERMISSIONS: functions.auth.HttpsError; SE_STORAGE_BUCKET_NOT_CONNECTED_TO_CEREMONY: functions.auth.HttpsError; SE_STORAGE_WRONG_OBJECT_KEY: functions.auth.HttpsError; SE_STORAGE_CANNOT_INTERACT_WITH_MULTI_PART_UPLOAD: functions.auth.HttpsError; SE_STORAGE_DOWNLOAD_FAILED: functions.auth.HttpsError; SE_STORAGE_UPLOAD_FAILED: functions.auth.HttpsError; SE_STORAGE_DELETE_FAILED: functions.auth.HttpsError; SE_CONTRIBUTE_NO_CEREMONY_CIRCUITS: functions.auth.HttpsError; SE_CONTRIBUTE_NO_OPENED_CEREMONIES: functions.auth.HttpsError; SE_CONTRIBUTE_CANNOT_PROGRESS_TO_NEXT_CIRCUIT: functions.auth.HttpsError; SE_PARTICIPANT_CEREMONY_NOT_OPENED: functions.auth.HttpsError; SE_PARTICIPANT_NOT_CONTRIBUTING: functions.auth.HttpsError; SE_PARTICIPANT_CANNOT_STORE_PERMANENT_DATA: functions.auth.HttpsError; SE_PARTICIPANT_CANNOT_STORE_TEMPORARY_DATA: functions.auth.HttpsError; SE_VERIFICATION_NO_PARTICIPANT_CONTRIBUTION_DATA: functions.auth.HttpsError; SE_CEREMONY_CANNOT_FINALIZE_CEREMONY: functions.auth.HttpsError; SE_FINALIZE_NO_CEREMONY_CONTRIBUTIONS: functions.auth.HttpsError; SE_FINALIZE_NO_FINAL_CONTRIBUTION: functions.auth.HttpsError; SE_VM_NOT_RUNNING: functions.auth.HttpsError; SE_VM_FAILED_COMMAND_EXECUTION: functions.auth.HttpsError; SE_VM_TIMEDOUT_COMMAND_EXECUTION: functions.auth.HttpsError; SE_VM_CANCELLED_COMMAND_EXECUTION: functions.auth.HttpsError; SE_VM_DELAYED_COMMAND_EXECUTION: functions.auth.HttpsError; SE_VM_UNKNOWN_COMMAND_STATUS: functions.auth.HttpsError; }; /** * A set of common errors. * @notice these are errors that happen on multiple cloud functions (e.g., auth, missing data). */ export declare const COMMON_ERRORS: { CM_NOT_COORDINATOR_ROLE: functions.auth.HttpsError; CM_MISSING_OR_WRONG_INPUT_DATA: functions.auth.HttpsError; CM_WRONG_CONFIGURATION: functions.auth.HttpsError; CM_NOT_AUTHENTICATED: functions.auth.HttpsError; CM_INEXISTENT_DOCUMENT: functions.auth.HttpsError; CM_INEXISTENT_DOCUMENT_DATA: functions.auth.HttpsError; CM_INVALID_CEREMONY_FOR_PARTICIPANT: functions.auth.HttpsError; CM_NO_CIRCUIT_FOR_GIVEN_SEQUENCE_POSITION: functions.auth.HttpsError; CM_INVALID_REQUEST: functions.auth.HttpsError; CM_INVALID_COMMAND_EXECUTION: functions.auth.HttpsError; }; //# sourceMappingURL=errors.d.ts.map