-
Notifications
You must be signed in to change notification settings - Fork 37
Unhandled exception handler is missing, causing application to crash when happened #6
Comments
Fixed (c8f0ceb). To test it, implement:
And, to causing the error:
You will got a default FCL-Web content, sush as:
|
I don't get the backtrace, the application is still terminated on error. Note that I'm using FastCGI. |
I'll test it. Please send me a small demo using fpWeb with FastCGI. |
Fixed (15f0141). Please test if it's OK. |
I can't merge this change automatically to my fork. Maybe you could? |
Hm... I have not found an option for that. :/ You can delete the project and fork again. |
Ah..I see that you've given write access for me, that's why. I'll do direct push from now as the way to manually merge involve some git commands I never use and must be done from terminal. |
OK, everything works now. I guess you need to document that in order the stack trace to appear, BrookSettings.PageXXX must be empty string. |
I fully agree. So, my friend who translates from Portuguese to English is on vacation and returns just in February, could you help me on this? |
Which source holds the documentation? Or where should I add this documentation? |
You can edit it directly in the .pas: 1 - https://github.com/silvioprog/brookframework/blob/master/core/brookutils.pas#L49 2 - https://github.com/silvioprog/brookframework/blob/master/core/brookutils.pas#L52 And after, you or I re-generate the HTML via PasDoc to upload it to the site. :) |
Nice?:
|
I'd add:
But reading about it... I'm thinking about a setting or property to allow stack trace to appear regardless the Page404 or Page500 is filled or not. Guess it would be easy to implement, I'll try something tonight (I have no git at office). |
This would be an interesting feature. |
This new feature is very important. I think a property is sufficient as leledumbo said. |
Implemented: 81492b2 |
So, closed. |
I think I'll have to change this commit, because the user (programmer) may be using purely JSON, and it would show an error message in HTML into JSON content, and this would be a problem. :/ |
Another interesting option would be to add an additional input format, an example of use would be:
I.e.: The first %s is the error message, and the last %s is the stack trace, so it would be used in JSON error too, e.g.:
Nice? |
Maybe:
and
So, using "macros". The user can use whatever information he want. |
Or, using JTemplate's syntax::
Good? |
For me is the same thing. The most import is the idea, not the implementation... in this case, of course. |
If you replace with a SysUtils.Format() style function, it might inadequate (because the search is done by index), but with JTemplate style it's better (search by name). |
Because this I suggested to use 'macros' (but doesn't matter which engine will be used).
I do not know. |
The question is for Silvio actually :3 |
About the 'macros', there are great chance to use the JTemplate sintax, because it is very simple and straightforward. About JTpl X FPTpl X TplParser: IMHO, I think the JTemplate more fast, sleek and intuitive, and it offers a native support for JSON and HTML. |
Implemented in "master" branch (the new "tmp" changes will be implemented in "working" branch): 57921e5. It is implemented using So, for this configuration:
The result is:
And for this:
The result is:
|
Hmm.. since SysUtils.Format is used, if the user doesn't supply the required %s (or if one supplies another %), it will cause a runtime error. Then how NOT to get the stack trace? |
You can omit the %s, e.g.:
The result:
Omitting both %s:
Result:
But it will be implemented with macros soon. :) |
So, an implementation for macro support:
Using |
That's better, since there will be only 2 placeholders, I think StrUtils.StringsReplace is fine. |
In case of unhandled exception occurs, a brook app will crash and causes HTTP 502, while in fpweb, it will generate a backtrace similar as in desktop application, only converted as html and sent as response. The application is still alive after that. Please add this functionality. You can take a look at custweb unit as an implementation reference. I tried making it as pluggable module but apparently I can't do any output from the exception handler and I think the better way is to make it integrated in the framework.
The text was updated successfully, but these errors were encountered: