Opened 6 years ago

Closed 6 years ago

#1811 closed enhancement (fixed)

Petascope_Error from WCPS should contain cause exception when necessary

Reported by: Bang Pham Huu Owned by: Bang Pham Huu
Priority: major Milestone: 9.7
Component: petascope Version: development
Keywords: Cc: Dimitar Misev, Vlad Merticariu
Complexity: Medium

Description

In Petascope all exceptions for WCPS is inherited from RuntimeException due to the way ANTLR4 processes each tree node and only support throw RuntimeException.

However, the root cause exception was lost (e.g: PetascopeException, SecoreException) while it should be attached to the wrapper exception WCPSException which will have the stack trace to trace easily.

Caused by: petascope.exceptions.WCPSException: Cannot process encode() operator. Reason: Encoding format 'image/jpasdas2' is not supported..
	at petascope.wcps.parser.WcpsEvaluator.visitEncodedCoverageExpressionLabel(WcpsEvaluator.java:333)
	at petascope.wcps.parser.WcpsEvaluator.visitEncodedCoverageExpressionLabel(WcpsEvaluator.java:134)
	at petascope.wcps.parser.wcpsParser$EncodedCoverageExpressionLabelContext.accept(wcpsParser.java:2446)
	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:68)
	at petascope.wcps.parser.wcpsBaseVisitor.visitProcessingExpression(wcpsBaseVisitor.java:229)
	at petascope.wcps.parser.wcpsParser$ProcessingExpressionContext.accept(wcpsParser.java:542)
	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:44)
	at petascope.wcps.parser.WcpsEvaluator.visitReturnClauseLabel(WcpsEvaluator.java:303)
	at petascope.wcps.parser.WcpsEvaluator.visitReturnClauseLabel(WcpsEvaluator.java:134)
	at petascope.wcps.parser.wcpsParser$ReturnClauseLabelContext.accept(wcpsParser.java:440)
	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:44)
	at petascope.wcps.parser.WcpsEvaluator.visitWcpsQueryLabel(WcpsEvaluator.java:267)
	at petascope.wcps.parser.WcpsEvaluator.visitWcpsQueryLabel(WcpsEvaluator.java:134)
	at petascope.wcps.parser.wcpsParser$WcpsQueryLabelContext.accept(wcpsParser.java:153)
	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:44)
	at petascope.wcps.parser.WcpsTranslator.getTranslationTree(WcpsTranslator.java:97)
	... 61 more

****************** Newly added from root cause ******************

Caused by: petascope.exceptions.PetascopeException: Encoding format 'image/jpasdas2' is not supported.
	at petascope.util.MIMEUtil.getMimeType(MIMEUtil.java:206)
	at petascope.wcps.handler.EncodeCoverageHandler.handle(EncodeCoverageHandler.java:80)
	at petascope.wcps.parser.WcpsEvaluator.visitEncodedCoverageExpressionLabel(WcpsEvaluator.java:330)

Change History (1)

comment:1 by Bang Pham Huu, 6 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.