-
Notifications
You must be signed in to change notification settings - Fork 10.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Standardize how error messages are sent from the server #2727
Comments
I agree, just thing that erro codes code start with "error-" so they will be grouped on the i18n.json files. |
To any exception thrown with Meteor.Error |
I agree we start using "error-..." on error codes (eg.: error-invalid-room). Error message should be english and without any reference to the method being called. So, instead of "[method] archiveRoom -> Invalid room.", we should use "Invalid room.". |
If we can pass more debug information as a 3rd parameter, I agree in removing the "[method] name ->" from the API messages. |
We can pass a 3rd parameter. I'll add { method: 'methodName' } to the error details. Can anyone think of any other info to get into details object? eg.: |
We should define some standards, such as what error to throw when user is not logged in, or when the operation is not allowed because the user lacks permission, or when the user doesn't belong to the room, etc. So, I vote for:
Any other suggestions? |
Or maybe using proper error codes could be better. That would also be the case for not being allowed or not belonging to room... in whichever case, the user is forbidden to do that action. Any specific errors would still use the |
I dont think http error codes are clear enough for our use cases. |
* Add function to handle errors * Delete message errors * handle error for hideRoom * Allow returning error instead of calling toastr.error * Handle error for leaveRoom * handle error for openRoom * handleError for toggleFavorite * handleError in updateMessage * error for samlLogout * handleError for assets * Add global handleError to eslint * handleError for addOAuthService * handleError: getUserRoles * handleError: insertOrUpdateUsere * handleError: messageDeleting * handleError: removeUserFromRoles * handleError: addPermissionToRole * handleError: addUserToRole * handleError: deleteRole * handleError: removeRoleFromPermission * handleError: removeUserFromRole * handleError: saveRole * Return ready on publish without permission * handleError: channel-settings * handleError: mailMessages * handleError: fileUpload * handleError: rocketchat-importer * handleError: addIncomingIntegration * handleError: deleteIncomingIntegration * handleError: updateIncomingIntegration * handleError: addOutgoingIntegration * handleError: deleteOutgoingIntegration * handleError: updateOutgoingIntegration * Return ready on publish without permission * handleError ldap * remove throw from client code * handleError: setEmail, slashCommand * Sort en.i18n.json * Google translated languages * Use correct error return from publishes * RateLimiter.limitFunction * Fix order of error "500" * handleError validateEmailDomain * handleError channelSettings; settings * handleError livechat * handleError: Mailer.sendMail * handleError pinMessage and unpinMessage * handleError messageStarring * handleError oauth apps * handleError: saveNotificationSettings * handleError getRoomRoles * handleError: createDirectMessage * handleError saveUserPreferences * handleError: saveUserProfile * handleError sendConfirmationEmail * Add ecmascript to root * handleError: avatar * handleError: getStatistics * handleError: roomSetting * handleError: channelSettings * handleError: sendInvitationEmail * handleError: addUserToRoom * handleError: uploadedFilesList * Change error key on user edit * handleError: userInfo * handleError: userRegistration * handleError: createChannel * handleError: createPrivateGroup * handleError: setUserPassword * handleError setUserActiveStatus * handleError: accoutns * A few more errors thrown * Error: livechat publishes * Errors in methods * handleError searchAgent * Add errors handling More errors handling Auto-translation for all languages * Permalink
Today error messages thrown from the server are not standardized. For example:
[method]
prefix of an untraslated messageI propose we thrown errors like the following:
invalid-username
,not-authorized
. This way our interface will take care of showing the correct translation for the error@RocketChat/core thoughts?
The text was updated successfully, but these errors were encountered: