Bug 915529 - [RFE] Better error reporting for REST API
Summary: [RFE] Better error reporting for REST API
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Zanata
Classification: Retired
Component: Component-API
Version: 2.1
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: ---
Assignee: Isaac Rooskov
QA Contact: Zanata-QA Mailling List
URL:
Whiteboard:
Depends On:
Blocks: 903964
TreeView+ depends on / blocked
 
Reported: 2013-02-26 00:39 UTC by Ding-Yi Chen
Modified: 2015-08-06 05:54 UTC (History)
2 users (show)

Fixed In Version:
Story Points: ---
Clone Of: 903964
Environment:
Last Closed: 2015-03-23 01:25:58 UTC
Embargoed:


Attachments (Terms of Use)

Description Ding-Yi Chen 2013-02-26 00:39:01 UTC
Description of problem:

Having REST API for Error Report not only helps developers quickly address bugs, but also helps users to figure out what's going on and fix the problem themselves.

Steps to Reproduce:
1. Attempt to push to a locale which has not been enabled for the project
2. Observe error message
  
Actual results:
Failed while pushing document translations: []

Expected results:
Failed while pushing document translations: Locale <locale> is not allowed for project <project> and version <version>. Please contact project maintainer.

Additional info:
+++ This bug was initially created as a clone of Bug #903964 +++

Description of problem:
With the asynchronous push implementation, if a push fails because of a permission check (eg locale not enabled on the server), the client error message is extremely generic ("Failed while pushing document translations"), even if exceptions are enabled with Maven's -e option.

By looking at the server log, I discovered that the actual cause was Locale <locale> is not allowed for project <project> and version <version>. Please contact project maintainer.  We should extend the async API so that the true error message can be propagated to the client, as it is with the older, synchronous version of push.


Version-Release number of selected component (if applicable):
Server 2.1.4-SNAPSHOT (20130125-0019)
Client 2.0.1

How reproducible:
100%

Steps to Reproduce:
1. Attempt to push to a locale which has not been enabled for the project
2. Observe error message
  
Actual results:
Failed while pushing document translations: []

Expected results:
Failed while pushing document translations: Locale <locale> is not allowed for project <project> and version <version>. Please contact project maintainer.

Additional info:
2013-01-25 16:12:36,034 ERROR [org.zanata.process.AsynchronousExecutor] (DefaultQuartzScheduler_Worker-7) Exception with long running process: Locale <locale> is not allowed for project <project> and version <version>. Please contact project maintainer.
2013-01-25 16:12:36,034 ERROR [org.zanata.rest.service.AsynchronousProcessResourceService] (DefaultQuartzScheduler_Worker-7) Error pushing translations
org.zanata.exception.ZanataServiceException: Locale <locale> is not allowed for project <project> and version <version>. Please contact project maintainer.
        at org.zanata.service.impl.LocaleServiceImpl.validateLocaleByProjectIteration(LocaleServiceImpl.java:196)
        at org.zanata.service.impl.LocaleServiceImpl_$$_javassist_seam_20.validateLocaleByProjectIteration(LocaleServiceImpl_$$_javassist_seam_20.java)
        at org.zanata.service.impl.TranslationServiceImpl.translateAllInDoc(TranslationServiceImpl.java:445)
        at org.zanata.service.impl.TranslationServiceImpl.translateAllInDoc(TranslationServiceImpl.java:411)
        at org.zanata.service.impl.TranslationServiceImpl_$$_javassist_seam_57.translateAllInDoc(TranslationServiceImpl_$$_javassist_seam_57.java)
        at org.zanata.rest.service.AsynchronousProcessResourceService$3.run(AsynchronousProcessResourceService.java:267)
        at org.zanata.rest.service.AsynchronousProcessResourceService$3.run(AsynchronousProcessResourceService.java:253)
        at org.zanata.process.AsynchronousExecutor.runAsynchronously(AsynchronousExecutor.java:61)
        at org.zanata.process.AsynchronousExecutor_$$_javassist_seam_56.runAsynchronously(AsynchronousExecutor_$$_javassist_seam_56.java)
(NB: I trimmed all non-zanata lines in the stack trace.)

--- Additional comment from Carlos Munoz on 2013-02-19 13:16:52 EST ---

Error messages produced by the server where being overwritten by a possibly empty set.

Fixed in 2.1.x and 2.2.x

See:
https://github.com/zanata/zanata/commit/c199df67738e5418091bd1224f0fa7fa83d9868a

--- Additional comment from Ding-Yi Chen on 2013-02-21 14:43:23 EST ---

Tested with Zanata version 2.1.5-SNAPSHOT (20130221-0020), maven client 2.0.2-SNAPSHOT

The actual error message become:
[WARNING] Authentication error: Unable to respond to any of these challenges: {}
[ERROR] Operation failed.

    To retry from the last document, please add the option: -Dzanata.fromDoc="ibus-chewing"

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.723s
[INFO] Finished at: Thu Feb 21 14:39:54 EST 2013
[INFO] Final Memory: 12M/123M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.zanata:zanata-maven-plugin:2.0.2-SNAPSHOT:push (default-cli) on project null: Zanata mojo exception: Error status 401 Unauthorized returned -> [Help 1]

Reassigned

--- Additional comment from Carlos Munoz on 2013-02-25 17:02:34 EST ---

The error is being handled and the message is actually correct although it's not very precise.

We need to do a general review of how we are handling error messages in the rest clients as it should be done in a uniform way accross the whole Rest API. 

We may need to map some general exceptions in the Rest API that can be subclassed and used by the business logic components, and then transformed into Http error codes by the REST components.

Comment 1 Ding-Yi Chen 2015-03-23 01:25:17 UTC
Fixed applied in Zanata-server-3.6.0 and zanata-maven-plugin-3.4.2


Note You need to log in before you can comment on or make changes to this bug.