Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Since in FileParsing many errors can happen, a fine granulated exception structure is needed. In other code places this is not the case. At least one own Exception per Plugin.

Internal Exception Structure

Each exception contains the mapping between the used event code and the related error message string. Since we are in an exception we can talk here about errors and not generally about events.

...

ExceptionHTTP CodeDescription / Idea behind
ZfExtended_BadMethodCallException405 Method Not AllowedMeans that the used HTTP Method is not allowed / not implemented.
So a usage makes only sense on the controller level.
ZfExtended_NotAuthenticatedException401 UnauthorizedMeans the the user is not authorized, so in the request there was no information to identify the user.
This error should redirect the user in the GUI to the login page.
ZfExtended_NotFoundException404 Not FoundIs used in application routing, is thrown when the whole requested route is not found (invalid URL).
ZfExtended_Models_Entity_NotFoundException404 Not FoundIs used if an entity can not be found (if it is loaded via an id or guid)
ZfExtended_NoAccessException
ZfExtended_Models_Entity_NoAccessException
403 Forbidden

The user (authenticated or not) is not allowed to see / manipulate the requested resource.
This can be either by missing ACLs, or missing other preconditions disallowing the request.
In difference to 422 and 409: the authenticated user is the reason why the request can not be processed.

TODO: clear the difference between both exceptions.

TODO new Unprocesseable Entity Exception
(or reuse ValidateException?)
422 Unprocessable Entity

Should be used PUT/POSTed content does prevent normal processing: Wrong parameters, missing parameters.
In other words: the requested call and its data is reasonable that the request can not be processed.

ZfExtended_Models_Entity_Conflict
ZfExtended_Conflict → will be removed TODO
409 ConflictShould be used if the status of the entity does prevent normal processing: The entity is locked, the entity is used/referenced in other places.
In other words: the entity it self is reasonable that the request can not be processed.

ZfExtended_VersionConflictException

409 ConflictMust only be used if entity can not be saved due a changed entity version. The classical usage of the 409 HTTP error: the entity was changed in the meantime.
ZfExtended_BadGateway
TODO implement 504 Gateway Timeout
502 Bad GatewayShould be used if our request calls internally a third party service, and the third party service or the communication with it does not work.
ZfExtended_Models_Entity_NotAcceptableException
ZfExtended_NotAcceptableException
TODO 422 Unprocessable Entity
406 Not AcceptableTODO: 406 Not Acceptable → makes no sense in the currently used application context, only in the REST router if invalid content according to the accept header is given.
Should be converted to: 422 Unprocessable Entity
ZfExtended_ValidateException400 Bad RequestTODO Since a Bad Request should only be given if the syntax is invalid (invalid JSON), the ValidateException should remain but should return a 422 instead?
ZfExtended_FileUploadException400 Bad RequestTODO, currently not used. Should be used in the context of errors with uploaded data
ZfExtended_Models_MaintenanceException503 Service UnavailableOnly usable in the context of the maintenance mode
ZfExtended_Models_Entity_Exceptions_IntegrityDuplicateKeyTODO → specific exception? No direct HTTP codeIs thrown on saving entities and the underlying DB call returns a "integrity constraint violation 1062 Duplicate entry" error:
That means an entity with such key does already exist (entities with additional unique keys, customer number or user login).
ZfExtended_Models_Entity_Exceptions_IntegrityConstraintTODO → specific exception? No direct HTTP code

Is thrown on saving/deleting entities and the underlying DB call returns one of the following "integrity constraint violation" error:

  • 1451 Cannot delete or update a parent row: a foreign key constraint fails → the to be deleted entity is used via foreign key, and may not deleted therefore.
  • 1452 Cannot add or update a child row: a foreign key constraint fails → the to be saved foreign entity does not exist (anymore)

...

Abgearbeitete Exceptions für die Doku

ZfExtended_BadMethodCallException extends ZfExtended_Exception

ZfExtended_NotAuthenticatedException extends ZfExtended_Exception

ZfExtended_NoAccessException extends ZfExtended_Exception

ZfExtended_Models_Entity_NoAccessException extends ZfExtended_NoAccessException {

ZfExtended_BadGateway extends ZfExtended_Exception

ZfExtended_NotFoundException extends ZfExtended_Exception

ZfExtended_Models_Entity_NotFoundException extends ZfExtended_Exception

ZfExtended_Models_Entity_NotAcceptableException extends ZfExtended_NotAcceptableException

ZfExtended_NotAcceptableException

ZfExtended_Conflict

ZfExtended_VersionConflictException extends ZfExtended_Exception

ZfExtended_ValidateException extends ZfExtended_Exception

ZfExtended_FileUploadException extends ZfExtended_Exception

ZfExtended_Models_MaintenanceException extends ZfExtended_Exception

ZfExtended_Models_Entity_Exceptions_IntegrityDuplicateKey extends ZfExtended_ErrorCodeException

ZfExtended_Models_Entity_Exceptions_IntegrityConstraint extends ZfExtended_ErrorCodeException

HERE:

Offene Exceptions für die Doku:

ZfExtended_ErrorCodeException extends ZfExtended_Exception

ZfExtended_Logger_Exception extends ZfExtended_Exception

ZfExtended_Plugin_MissingDependencyException extends ZfExtended_Exception

ZfExtended_Plugin_ExclusionException extends ZfExtended_Exception

AcrossSoapConnectorException extends Exception

editor_Plugins_TermTagger_Exception_Open extends editor_Plugins_TermTagger_Exception_Abstract

editor_Plugins_TermTagger_Exception_Abstract extends ZfExtended_Exception

editor_Plugins_TermTagger_Exception_Request extends editor_Plugins_TermTagger_Exception_Abstract

editor_Plugins_TermTagger_Exception_Malfunction extends editor_Plugins_TermTagger_Exception_Abstract

editor_Plugins_Okapi_Exception extends ZfExtended_Exception

editor_Models_Segment_TermTagTrackChangeStopException extends Exception

editor_Models_Import_TaskFoundException extends ZfExtended_Exception

editor_Models_Import_FileParser_Sdlxliff_Exception extends editor_Models_Import_FileParser_Exception

editor_Models_Import_FileParser_Exception extends ZfExtended_ErrorCodeException








Examples for specific Exceptions

This exceptions are used in the case of errors in the application.

Handling of such exceptions:

  1. They are caught and the application deals with the error.
    No impact to the

Examples for specific Exceptions

This exceptions are used in the case of errors in the application.

Handling of such exceptions:

  1. They are caught and the application deals with the error.
    No impact to the API result.
  2. They are caught and the exceptions is translated into an exception with semantic
    This happens mostly on the Controller level. The main error message remains untranslated.
    In an additional Container multiple errors, with extra data and translated messages can be stored into the semantic exception.
  3. Nothing is done and the exception bubbles to the caller:
    In direct API usage this should happen only if we really don't except that such exceptions happens.
    In worker context it is Ok to bubble such exceptions, since they are called via REST,
    but are then mostly running asynchronous without answering in a RESTfull way to the caller.
    This exceptions are transported untranslated into the GUI.

ExceptionDescription / Idea behind
editor_Models_Import_FileParser_Sdlxliff_ExceptionException which is thrown on the usage of the SdlXliff fileparser.
ZfExtended_Logger_ExceptionException which is thrown in the context of error logging, so if in the logging is happening an error
ZfExtended_ErrorCodeExceptionBase class for all ErrorCode based Exceptions


EventCodes

The EventCodes used in exceptions and other logging usages are defined via the ErrorCodes listed and maintained in confluence..

...