@fnlb-project/shared 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/errors/index.d.ts +6 -6
- package/dist/errors/index.js +1 -1
- package/package.json +1 -1
package/dist/errors/index.d.ts
CHANGED
|
@@ -98,11 +98,11 @@ export interface IParsedError extends IBaseError {
|
|
|
98
98
|
declare const errorMap: {
|
|
99
99
|
readonly "net.fnlb.errors.generic.unknown": {
|
|
100
100
|
readonly type: ErrorTypes.General;
|
|
101
|
-
readonly message: "An unknown error occurred.
|
|
101
|
+
readonly message: "An unknown error occurred. Please try again later.";
|
|
102
102
|
};
|
|
103
103
|
readonly "net.fnlb.errors.generic.internal_error": {
|
|
104
104
|
readonly type: ErrorTypes.General;
|
|
105
|
-
readonly message: "An internal
|
|
105
|
+
readonly message: "An internal error occurred. Please try again later.";
|
|
106
106
|
};
|
|
107
107
|
readonly "net.fnlb.errors.generic.validation_failed": {
|
|
108
108
|
readonly type: ErrorTypes.General;
|
|
@@ -122,7 +122,7 @@ declare const errorMap: {
|
|
|
122
122
|
};
|
|
123
123
|
readonly "net.fnlb.errors.common.unable_to_process_request": {
|
|
124
124
|
readonly type: ErrorTypes.General;
|
|
125
|
-
readonly message: "Unable to process the request. Please try again.";
|
|
125
|
+
readonly message: "Unable to process the request. Please try again later.";
|
|
126
126
|
};
|
|
127
127
|
readonly "net.fnlb.errors.common.invalid_body_fields_length": {
|
|
128
128
|
readonly type: ErrorTypes.General;
|
|
@@ -190,15 +190,15 @@ declare const errorMap: {
|
|
|
190
190
|
};
|
|
191
191
|
readonly "net.fnlb.errors.oauth2.unable_to_fetch_connections": {
|
|
192
192
|
readonly type: ErrorTypes.General;
|
|
193
|
-
readonly message: "Unable to obtain
|
|
193
|
+
readonly message: "Unable to obtain connections. Please try again later.";
|
|
194
194
|
};
|
|
195
195
|
readonly "net.fnlb.errors.oauth2.user_without_connection": {
|
|
196
196
|
readonly type: ErrorTypes.General;
|
|
197
|
-
readonly message: "
|
|
197
|
+
readonly message: "No connections found. Please add a connection and try again later.";
|
|
198
198
|
};
|
|
199
199
|
readonly "net.fnlb.errors.oauth2.connection_not_verified": {
|
|
200
200
|
readonly type: ErrorTypes.General;
|
|
201
|
-
readonly message: "
|
|
201
|
+
readonly message: "The connection is not verified. Please try again later.";
|
|
202
202
|
};
|
|
203
203
|
readonly "net.fnlb.errors.release.no_release_found": {
|
|
204
204
|
readonly type: ErrorTypes.General;
|
package/dist/errors/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var d;((a)=>{a.GenericUnknown="net.fnlb.errors.generic.unknown";a.GenericInternalError="net.fnlb.errors.generic.internal_error";a.GenericValidationFailed="net.fnlb.errors.generic.validation_failed";a.GenericParseFailed="net.fnlb.errors.generic.parse_failed";a.GenericNotFound="net.fnlb.errors.generic.not_found";a.CommonInvalidRequest="net.fnlb.errors.common.invalid_request";a.CommonUnableToProcessRequest="net.fnlb.errors.common.unable_to_process_request";a.CommonInvalidFieldsLength="net.fnlb.errors.common.invalid_body_fields_length";a.CommonRateLimitExceeded="net.fnlb.errors.common.rate_limit_exceeded";a.CommonUnableToSaveToDatabase="net.fnlb.errors.common.unable_to_save_to_database";a.AuthInvalidToken="net.fnlb.errors.auth.invalid_token";a.AuthInvalidAPIToken="net.fnlb.errors.auth.invalid_api_token";a.AuthInvalidCaptchaToken="net.fnlb.errors.auth.invalid_captcha_token";a.AuthUnauthorized="net.fnlb.errors.auth.unauthorized";a.AuthUserBanned="net.fnlb.errors.auth.user_banned";a.Oauth2InvalidCode="net.fnlb.errors.oauth2.invalid_code";a.Oauth2InvalidScope="net.fnlb.errors.oauth2.invalid_scope";a.Oauth2TokenInvalid="net.fnlb.errors.oauth2.token_invalid";a.Oauth2UnableToFetchUser="net.fnlb.errors.oauth2.unable_to_fetch_user";a.Oauth2UnableToFetchConnections="net.fnlb.errors.oauth2.unable_to_fetch_connections";a.Oauth2UserWithoutConnection="net.fnlb.errors.oauth2.user_without_connection";a.Oauth2ConnectionNotVerified="net.fnlb.errors.oauth2.connection_not_verified";a.ReleaseNotFound="net.fnlb.errors.release.no_release_found";a.ReleaseVersionAlreadyExists="net.fnlb.errors.release.version_already_exists"})(d||={});var h;((i)=>{i.LoginInvalidCredentials="net.fnlb.errors.login.invalid_credentials";i.LoginInvalidEmail="net.fnlb.errors.login.invalid_email";i.LoginInvalidOrUsedEmail="net.fnlb.errors.login.invalid_or_used_email";i.AuthPasswordConfirmationInvalid="net.fnlb.errors.auth.invalid_password_confirmation"})(h||={});var e={...d,...h};var m={[e.GenericUnknown]:{type:"general",message:"An unknown error occurred. Please try again later."},[e.GenericInternalError]:{type:"general",message:"An internal error occurred. Please try again later."},[e.GenericValidationFailed]:{type:"general",message:"Validation of the request data failed."},[e.GenericParseFailed]:{type:"general",message:"The request could not be parsed. This may be due to a malformed input or an unsupported data format."},[e.GenericNotFound]:{type:"general",message:"The requested resource does not exist."},[e.CommonInvalidRequest]:{type:"general",message:"The request is not valid."},[e.CommonUnableToProcessRequest]:{type:"general",message:"Unable to process the request. Please try again later."},[e.CommonInvalidFieldsLength]:{type:"general",message:"The body fields have an invalid length."},[e.CommonRateLimitExceeded]:{type:"general",message:"You are being rate limited."},[e.CommonUnableToSaveToDatabase]:{type:"general",message:"Unable to save changes. Please check all fields."},[e.AuthInvalidToken]:{type:"general",message:"Invalid token provided."},[e.AuthInvalidAPIToken]:{type:"general",message:"Invalid API token provided."},[e.AuthInvalidCaptchaToken]:{type:"general",message:"Sorry, the captcha was not resolved correctly. Please try again."},[e.AuthUnauthorized]:{type:"general",message:"You are not authorized to perform this action."},[e.AuthUserBanned]:{type:"general",message:"Your account is banned from the service."},[e.AuthPasswordConfirmationInvalid]:{type:"input",message:"Sorry, the password is invalid or does not match."},[e.LoginInvalidCredentials]:{type:"input",message:"The email or password is incorrect."},[e.LoginInvalidEmail]:{type:"input",message:"The email is invalid."},[e.LoginInvalidOrUsedEmail]:{type:"input",message:"The email is invalid or is already used."},[e.Oauth2InvalidCode]:{type:"general",message:"Unable to verify your request at this moment. Please try again later."},[e.Oauth2InvalidScope]:{type:"general",message:"Invalid scope provided."},[e.Oauth2TokenInvalid]:{type:"general",message:"Unable to verify Oauth2 token. Please try again later."},[e.Oauth2UnableToFetchUser]:{type:"general",message:"Unable to obtain user information. Please try again later."},[e.Oauth2UnableToFetchConnections]:{type:"general",message:"Unable to obtain connections. Please try again later."},[e.Oauth2UserWithoutConnection]:{type:"general",message:"No connections found. Please add a connection and try again later."},[e.Oauth2ConnectionNotVerified]:{type:"general",message:"The connection is not verified. Please try again later."},[e.ReleaseNotFound]:{type:"general",message:"Sorry, no release found. Please try again later."},[e.ReleaseVersionAlreadyExists]:{type:"general",message:"Release version already exists."}};class s{static getError(n){return m[n]??m[e.GenericUnknown]}static getErrorResponse(n,t){if(Array.isArray(n))return{type:"error",errors:n.map((l)=>s.parseErrorCode(l,t))};else return{type:"error",errors:[s.parseErrorCode(n,t)]}}static parseErrorResponse(n){if(!s.isErrorResponse(n))return null;return n.errors}static isErrorResponse(n){return n?.type==="error"}static parseErrorCode(n,t){const{type:l,message:u}=s.getError(n);if(l==="input"){if(t===void 0)throw new Error("Input is required for Input errors");return{type:l,message:u,errorCode:n,input:t}}else return{type:l,message:u,errorCode:n}}static handleErrors(n,t){switch(n){case"VALIDATION":return[400,s.getErrorResponse(e.GenericValidationFailed)];case"NOT_FOUND":return[404,s.getErrorResponse(e.GenericNotFound)];case"PARSE":return[400,s.getErrorResponse(e.GenericParseFailed)];case"INTERNAL_SERVER_ERROR":return console.error(t),[500,s.getErrorResponse(e.GenericInternalError)];default:return console.error(t),[500,s.getErrorResponse(e.GenericUnknown)]}}}export{s as ErrorHandler};
|