WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
188695
[GLIB] Complete the JSCException API
https://bugs.webkit.org/show_bug.cgi?id=188695
Summary
[GLIB] Complete the JSCException API
Carlos Garcia Campos
Reported
2018-08-17 03:34:54 PDT
Add more API to JSCException: * New function to get the column number * New function get exception as string (toString()) * Add the possibility to create exceptions with a custom error name. * New function to get the exception error name * Convenience function to report a exception by returning a formatted string with all the exception details, to be shown as a user error message.
Attachments
Patch
(25.98 KB, patch)
2018-08-17 03:38 PDT
,
Carlos Garcia Campos
no flags
Details
Formatted Diff
Diff
Patch
(26.02 KB, patch)
2018-08-17 05:32 PDT
,
Carlos Garcia Campos
mcatanzaro
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Carlos Garcia Campos
Comment 1
2018-08-17 03:38:13 PDT
Created
attachment 347356
[details]
Patch
Adrian Perez
Comment 2
2018-08-17 04:48:08 PDT
Comment on
attachment 347356
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=347356&action=review
Looks good to me overall, but please check the comment about using “backtrace” instead of “back trace” before landing.
> Source/JavaScriptCore/API/glib/JSCException.cpp:262 > + * jsc_exception_get_back_trace_string:
Somehow this function name feels a bit clunky when reading it, because usually “backtrace” is how the term is written. For the sake of double checking, I did the following: % rg -i backtrace /usr/include/|wc -l 408 % rg -i back_trace /usr/include/ | wc -l 0 I am *very* sure that we want this to be “jsc_exception_get_backtrace_string”.
> Source/JavaScriptCore/API/glib/JSCException.cpp:265 > + * Get a string with the exception back trace.
Let's also use “backtrace” in documentation comments, please.
Adrian Perez
Comment 3
2018-08-17 04:52:59 PDT
(In reply to Adrian Perez from
comment #2
)
> > Source/JavaScriptCore/API/glib/JSCException.cpp:262 > > + * jsc_exception_get_back_trace_string: > > Somehow this function name feels a bit clunky when reading it, because > usually “backtrace” is how the term is written. For the sake of double > checking, I did the following: > > % rg -i backtrace /usr/include/|wc -l > 408 > % rg -i back_trace /usr/include/ | wc -l > 0
Also, “backtrace” is written as a single word in many online resources, and used as such in other programming languages and library functions: -
https://secure.php.net/manual/en/function.debug-backtrace.php
-
https://linux.die.net/man/3/backtrace
-
https://sourceware.org/gdb/onlinedocs/gdb/Backtrace.html
-
https://wiki.ubuntu.com/Backtrace
-
https://en.wikipedia.org/wiki/Stack_trace
Example from the Wikipedia page: “In computing, a stack trace (also called stack backtrace[1] or stack traceback[2]) is […]”
Carlos Garcia Campos
Comment 4
2018-08-17 05:02:42 PDT
Ok, I'll update the patch to use backtrace instead. Thanks Adrian!
Carlos Garcia Campos
Comment 5
2018-08-17 05:32:31 PDT
Created
attachment 347358
[details]
Patch
Adrian Perez
Comment 6
2018-08-17 06:32:39 PDT
(In reply to Carlos Garcia Campos from
comment #4
)
> Ok, I'll update the patch to use backtrace instead. Thanks Adrian!
The patch looks perfect now, thanks! r+ all the things! :-)
Michael Catanzaro
Comment 7
2018-08-17 07:26:53 PDT
Comment on
attachment 347358
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=347358&action=review
> Source/JavaScriptCore/API/glib/JSCException.cpp:269 > +const char* jsc_exception_get_backtrace_string(JSCException* exception)
Hm, shouldn't it use const gchar*, for consistency with our other public APIs? I know gchar/gint/etc. are dumb types, but consistency is good. Maybe you should audit the entire JSC API for this. We definitely use the g types in the WebKit2 API, for example.
> Source/JavaScriptCore/API/glib/JSCException.cpp:286 > + * Get the string representation of @exception error. > + * > + * Returns: (transfer full): the string representation of @exception error.
It reads better without the word "error" at the end. "Get the string representation of @exception. Returns: (transfer full): the string representation of @exception."
Carlos Garcia Campos
Comment 8
2018-08-19 23:57:23 PDT
Committed
r235023
: <
https://trac.webkit.org/changeset/235023
>
Radar WebKit Bug Importer
Comment 9
2018-08-20 16:53:13 PDT
<
rdar://problem/43534489
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug