UNPKG

@junobuild/errors

Version:

A collection of predefined error constants and utilities for Juno applications.

8 lines (7 loc) 3.72 kB
{ "version": 3, "sources": ["../../src/constants.ts", "../../src/utils.ts"], "sourcesContent": ["export const JUNO_ERROR_NO_TIMESTAMP_PROVIDED = 'juno.error.no_timestamp_provided';\nexport const JUNO_ERROR_TIMESTAMP_OUTDATED_OR_FUTURE = 'juno.error.timestamp_outdated_or_future';\nexport const JUNO_ERROR_NO_VERSION_PROVIDED = 'juno.error.no_version_provided';\nexport const JUNO_ERROR_VERSION_OUTDATED_OR_FUTURE = 'juno.error.version_outdated_or_future';\n\nexport const JUNO_DATASTORE_ERROR_CANNOT_WRITE = 'juno.datastore.error.cannot_write';\nexport const JUNO_DATASTORE_ERROR_CANNOT_READ = 'juno.datastore.error.cannot_read';\n\nexport const JUNO_STORAGE_ERROR_UPLOAD_NOT_ALLOWED = 'juno.storage.error.upload_not_allowed';\nexport const JUNO_STORAGE_ERROR_SET_NOT_ALLOWED = 'juno.storage.error.set_not_allowed';\nexport const JUNO_STORAGE_ERROR_CANNOT_COMMIT_BATCH = 'juno.storage.error.cannot_commit_batch';\nexport const JUNO_STORAGE_ERROR_ASSET_NOT_FOUND = 'juno.storage.error.asset_not_found';\nexport const JUNO_STORAGE_ERROR_CANNOT_READ_ASSET = 'juno.storage.error.cannot_read_asset';\n\nexport const JUNO_AUTH_ERROR_NOT_ADMIN_CONTROLLER = 'juno.auth.error.not_admin_controller';\nexport const JUNO_AUTH_ERROR_INVALID_ORIGIN = 'juno.auth.error.invalid_origin';\nexport const JUNO_AUTH_ERROR_NOT_CONTROLLER = 'juno.auth.error.not_controller';\n\nexport const JUNO_DATASTORE_ERROR_USER_CANNOT_UPDATE = 'juno.datastore.error.user.cannot_update';\nexport const JUNO_DATASTORE_ERROR_USER_INVALID_DATA = 'juno.datastore.error.user.invalid_data';\nexport const JUNO_DATASTORE_ERROR_USER_CALLER_KEY = 'juno.datastore.error.user.caller_key';\nexport const JUNO_DATASTORE_ERROR_USER_KEY_NO_PRINCIPAL =\n 'juno.datastore.error.user.key_no_principal';\nexport const JUNO_DATASTORE_ERROR_USER_NOT_ALLOWED = 'juno.datastore.error.user.not_allowed';\nexport const JUNO_DATASTORE_ERROR_USER_USAGE_CHANGE_LIMIT_REACHED =\n 'juno.datastore.error.user.usage.change_limit_reached';\nexport const JUNO_DATASTORE_ERROR_USER_USAGE_INVALID_DATA =\n 'juno.datastore.error.user.usage.invalid_data';\n", "export const isSatelliteError = ({error, type}: {error: unknown; type: string}): boolean => {\n if (typeof error === 'string') {\n return error.includes(type);\n }\n\n if (error instanceof Error) {\n return error.message.includes(type);\n }\n\n return false;\n};\n"], "mappings": ";;AAAO,IAAMA,EAAmC,mCACnCC,EAA0C,0CAC1CC,EAAiC,iCACjCC,EAAwC,wCAExCC,EAAoC,oCACpCC,EAAmC,mCAEnCC,EAAwC,wCACxCC,EAAqC,qCACrCC,EAAyC,yCACzCC,EAAqC,qCACrCC,EAAuC,uCAEvCC,EAAuC,uCACvCC,EAAiC,iCACjCC,EAAiC,iCAEjCC,EAA0C,0CAC1CC,EAAyC,yCACzCC,EAAuC,uCACvCC,EACX,6CACWC,EAAwC,wCACxCC,EACX,uDACWC,EACX,+CC3BK,IAAMC,EAAmB,CAAC,CAAC,MAAAC,EAAO,KAAAC,CAAI,IACvC,OAAOD,GAAU,SACZA,EAAM,SAASC,CAAI,EAGxBD,aAAiB,MACZA,EAAM,QAAQ,SAASC,CAAI,EAG7B", "names": ["JUNO_ERROR_NO_TIMESTAMP_PROVIDED", "JUNO_ERROR_TIMESTAMP_OUTDATED_OR_FUTURE", "JUNO_ERROR_NO_VERSION_PROVIDED", "JUNO_ERROR_VERSION_OUTDATED_OR_FUTURE", "JUNO_DATASTORE_ERROR_CANNOT_WRITE", "JUNO_DATASTORE_ERROR_CANNOT_READ", "JUNO_STORAGE_ERROR_UPLOAD_NOT_ALLOWED", "JUNO_STORAGE_ERROR_SET_NOT_ALLOWED", "JUNO_STORAGE_ERROR_CANNOT_COMMIT_BATCH", "JUNO_STORAGE_ERROR_ASSET_NOT_FOUND", "JUNO_STORAGE_ERROR_CANNOT_READ_ASSET", "JUNO_AUTH_ERROR_NOT_ADMIN_CONTROLLER", "JUNO_AUTH_ERROR_INVALID_ORIGIN", "JUNO_AUTH_ERROR_NOT_CONTROLLER", "JUNO_DATASTORE_ERROR_USER_CANNOT_UPDATE", "JUNO_DATASTORE_ERROR_USER_INVALID_DATA", "JUNO_DATASTORE_ERROR_USER_CALLER_KEY", "JUNO_DATASTORE_ERROR_USER_KEY_NO_PRINCIPAL", "JUNO_DATASTORE_ERROR_USER_NOT_ALLOWED", "JUNO_DATASTORE_ERROR_USER_USAGE_CHANGE_LIMIT_REACHED", "JUNO_DATASTORE_ERROR_USER_USAGE_INVALID_DATA", "isSatelliteError", "error", "type"] }