Skip to content

Conversation

@JanTvrdik
Copy link
Contributor

In PHP it is quite common to use "shut-up + escalating error to exception" pattern (example). Unfortunately the original error message is lost unless error_get_last()['message'] is manually appended to exception message.

What about adding a simple panel to bluescreen to show the last error? The error may not always be related. We may attempt to do some magic to filter the relevant error but I'm not sure it's worth it.


Related: nette/utils#94

@hrach
Copy link
Contributor

hrach commented Jan 21, 2016

👍

2 similar comments
@fprochazka
Copy link
Contributor

👍

@dg
Copy link
Member

dg commented Jan 22, 2016

👍

@fprochazka
Copy link
Contributor

@JanTvrdik I would start simple and just implement it naively and if there are some cases where the info is irelevant, we might iterate on that after.

@JanTvrdik
Copy link
Contributor Author

Announcement to all talented programmers

This is your last chance to implement this awesome idea. If there will be no PR at 20.00 today, I'll do it myself and you will loose the unique opportunity to became famous for implementing this.

@dg
Copy link
Member

dg commented Mar 1, 2016

😀

@fprochazka
Copy link
Contributor

super bussy ted

JanTvrdik added a commit to JanTvrdik/nette-tracy that referenced this pull request Mar 2, 2016
@JanTvrdik JanTvrdik force-pushed the pr/last_error_panel branch from 593921b to 70ef7f2 Compare March 2, 2016 13:10
JanTvrdik added a commit to JanTvrdik/nette-tracy that referenced this pull request Mar 2, 2016
@JanTvrdik
Copy link
Contributor Author

Any thoughts?

@fprochazka
Copy link
Contributor

@JanTvrdik maybe it would be nice to hide the error, if the rendered exception is ErrorException created by nette handler and the error would be exactly the same?

@JanTvrdik
Copy link
Contributor Author

@fprochazka I know but I don't see a simple and reliable way to write the condition. You may check ErrorException + file + line but it may have some false positives.

@JanTvrdik
Copy link
Contributor Author

ping @dg, is this ok? should i fix tests?

<h2><a data-tracy-ref="^+" class="tracy-toggle tracy-collapsed">Last error</a></h2>
<div class="tracy-collapsed inner">

<h2><?= Helpers::errorTypeToString($error['type']) ?>: <?= htmlspecialchars($error['message'], ENT_IGNORE, 'UTF-8') ?></h2>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inside H2 should be H3.

@dg dg force-pushed the master branch 4 times, most recently from 5dd8d3e to 5ecd8e7 Compare April 21, 2016 12:19
@dg dg force-pushed the master branch 6 times, most recently from 7f3fd63 to bbc898e Compare May 19, 2016 14:17
@JanTvrdik JanTvrdik closed this May 19, 2016
@JanTvrdik JanTvrdik force-pushed the pr/last_error_panel branch from d95bc4c to a7b64a4 Compare May 19, 2016 21:43
@JanTvrdik JanTvrdik reopened this May 19, 2016
@JanTvrdik
Copy link
Contributor Author

😫 I've put hours of energy into an attempt to fix the tests and it's still not done. This is ridiculous. 😫

? $source . (strpos($source, '?') ? '&' : '?') . '_tracy_skip_error'
: NULL;
$lastError = (!$exception instanceof \ErrorException) ? error_get_last() : NULL;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$lastError = $exception instanceof \ErrorException ? NULL : error_get_last(); seems better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants