Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor errorhandler #2916

Merged
merged 11 commits into from
Mar 30, 2014
Merged

Refactor errorhandler #2916

merged 11 commits into from
Mar 30, 2014

Conversation

cebe
Copy link
Member

@cebe cebe commented Mar 29, 2014

  • Moved all ErrorHandling methods from Application to ErrorHandler
  • split errorhandler into two components, base and web.
  • fixed some minor issues in web display
  • improved error output on console
  • fix setup of errorhandler in app init()
  • check how ErrorHandler reacts to error_reporting setting

fixes #1946, fixes #2516

looks like tests are failing because it was February last month :-)

}
// it is too late to log an error message here
$exception = ErrorHandler::convertExceptionToString($e);
// its too late to use Yii logging here
Copy link
Member

Choose a reason for hiding this comment

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

Why it's too late?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, it's still there: http://php.net/manual/en/function.session-set-save-handler.php

The "write" handler is not executed until after the output stream is closed. Thus, output from debugging statements in the "write" handler will never be seen in the browser. If debugging output is necessary, it is suggested that the debug output be written to a file instead.

* master:
  Fixes #2912: Relative view files will be looked for under the directory containing the view currently being rendered
  app end improvement.
  improvement of Application::end() handling.
  typo fix.
  Fixes #2910: Added `Application::end()`

Conflicts:
	framework/base/Application.php
return '<a href="http://yiiframework.com/doc/api/2.0/' . $this->htmlEncode($matches[1]) . '" target="_blank">' .
$this->htmlEncode($matches[1]) . '</a>()';
}, $code);
$message .= $this->formatMessage(" '" . get_class($exception) . "'", [Console::BOLD, Console::FG_BLUE])
Copy link
Member

Choose a reason for hiding this comment

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

Could be extracted into ConsoleErrorHandler::renderException

@cebe cebe added this to the 2.0 Beta milestone Mar 29, 2014
@cebe
Copy link
Member Author

cebe commented Mar 30, 2014

Ready for merge now.

*/
public function createServerInformationLink()
{
static $serverUrls = [
Copy link
Contributor

Choose a reason for hiding this comment

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

why static ?

Copy link
Member Author

Choose a reason for hiding this comment

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

why not? Note that this is just copied from base errorhandler.

Copy link
Contributor

Choose a reason for hiding this comment

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

we dont need to keep some instances between objects so it can be here simple $serverUrls, there is no such situation as in Yii1 with CLocale where we need to store all locales for example.

Copy link
Member Author

Choose a reason for hiding this comment

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

static will ensure this array is stored only once even in multiple calls. I see no problem as it is constant. Also this only appears when an error page is rendered.

Copy link
Contributor

Choose a reason for hiding this comment

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

yep, but i dont think that this is the case to ensure that stored only once, anyway it is good to have fine console exception now.

@qiangxue
Copy link
Member

Looks good to me. Good job!

cebe added a commit that referenced this pull request Mar 30, 2014
@cebe cebe merged commit 21f2602 into master Mar 30, 2014
@cebe cebe deleted the refactor-errorhandler branch March 30, 2014 20:54
@samdark samdark mentioned this pull request Sep 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants