metasfresh / metasfresh-webui-api-legacy

metasfresh webui API server
GNU General Public License v3.0
30 stars 32 forks source link

Include stacktrace when providing the error to frontend #817

Closed teosarca closed 6 years ago

teosarca commented 6 years ago

Is this a bug or feature request?

FR

What is the current behavior?

When an endpoint fails an error JSON is returned to frontend but without a stacktrace. Tester has to check the webui server console and fetch the stacktrace from there.

Which are the steps to reproduce?

Make make some enpoint fail.

What is the expected or desired behavior?

Error JSON shall contain "trace" node where the stacktrace is provided.

Configuration

application.properties:

server.error.include-stacktrace=always

It can be: never, always, on-trace-param. See https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/autoconfigure/web/ErrorProperties.IncludeStacktrace.html

By default is set to "always". See https://github.com/metasfresh/metasfresh-webui-api/blob/master/src/main/resources/application.properties.

teosarca commented 6 years ago

It should look like this: image

It's far from being perfect or handy to use but you can select & copy trace and paste it to the right issue. The copied text looks quite shitty but it's kind of readable and better than nothing. e.g.

trace
:
["org.adempiere.exceptions.AdempiereException: Invalid viewId: x",…]
0
:
"org.adempiere.exceptions.AdempiereException: Invalid viewId: x"
1
:
"   at de.metas.ui.web.view.ViewId.ofViewIdString(ViewId.java:68)"
2
:
"   at de.metas.ui.web.view.ViewId.of(ViewId.java:52)"
3
:
"   at de.metas.ui.web.view.ViewRestController.getViewData(ViewRestController.java:216)"
4
:
"   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)"
5
:
"   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)"
6
:
"   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)"
7
:
"   at java.lang.reflect.Method.invoke(Method.java:498)"
8
:
"   at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)"
9
:
"   at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)"
10
:
"   at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)"
11
:
"   at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)"
12
:
"   at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)"
13
:
"   at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)"
14
:
"   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)"
15
:
"   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)"
16
:
"   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)"
17
:
"   at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)"
18
:
"   at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)"
19
:
"   at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)"
20
:
"   at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)"
21
:
"   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)"
22
:
"   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)"
23
:
"   at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)"
24
:
"   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)"
25
:
"   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)"
26
:
"   at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55)"
27
:
"   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)"
28
:
"   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)"
29
:
"   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)"
30
:
"   at de.metas.ui.web.config.WebConfig$1.doFilter(WebConfig.java:82)"
31
:
"   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)"
32
:
"   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)"
33
:
"   at de.metas.ui.web.config.ServletLoggingFilter.doFilter(ServletLoggingFilter.java:89)"
34
:
"   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)"
35
:
"   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)"
36
:
"   at de.metas.ui.web.config.CORSFilter.doFilter(CORSFilter.java:85)"
37
:
"   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)"
38
:
"   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)"
39
:
"   at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:110)"
40
:
"   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)"
41
:
"   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)"
42
:
"   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)"
43
:
"   at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)"
44
:
"   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)"
45
:
"   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)"
46
:
"   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)"
47
:
"   at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:105)"
48
:
"   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)"
49
:
"   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)"
50
:
"   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)"
51
:
"   at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)"
52
:
"   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)"
53
:
"   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)"
54
:
"   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)"
55
:
"   at org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:167)"
56
:
"   at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:80)"
57
:
"   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)"
58
:
"   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)"
59
:
"   at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)"
60
:
"   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)"
61
:
"   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)"
62
:
"   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)"
63
:
"   at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:106)"
64
:
"   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)"
65
:
"   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)"
66
:
"   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)"
67
:
"   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)"
68
:
"   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)"
69
:
"   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)"
70
:
"   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)"
71
:
"   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)"
72
:
"   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)"
73
:
"   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)"
74
:
"   at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)"
75
:
"   at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)"
76
:
"   at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861)"
77
:
"   at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)"
78
:
"   at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)"
79
:
"   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)"
80
:
"   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)"
81
:
"   at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)"
82
:
"   at java.lang.Thread.run(Thread.java:748)"
83
:
""
metas-lc commented 6 years ago

IT managed to get an error using hu transform. Took a look in preview: stacktrace is there ("trace") OK