-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a configuration hide_stack_trace on conf.lua that, if set to true, will not show the stack trace and throw a default 500 Internal Server Error message.
- Loading branch information
Showing
2 changed files
with
16 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
-------------------------------------------------------------------------------- | ||
-- sailor.lua, v0.4.16: core functionalities of the framework | ||
-- sailor.lua, v0.5.0: core functionalities of the framework | ||
-- This file is a part of Sailor project | ||
-- Copyright (c) 2014 Etiene Dalcol <[email protected]> | ||
-- License: MIT | ||
|
@@ -13,7 +13,7 @@ local sailor = { | |
conf = conf.sailor, | ||
_COPYRIGHT = "Copyright (C) 2014-2015 Etiene Dalcol", | ||
_DESCRIPTION = "Sailor is a framework for creating MVC web applications.", | ||
_VERSION = "Sailor 0.4.16", | ||
_VERSION = "Sailor 0.5.0", | ||
} | ||
|
||
-- Loads Lua@client's settings from Sailor conf. | ||
|
@@ -90,6 +90,14 @@ function sailor.init(r) | |
POSTMULTI = POSTMULTI, | ||
base_path = sailor.base_path | ||
} | ||
|
||
if conf.extensions and conf.extensions.enable then | ||
for _,e in pairs(conf.extensions.enable) do | ||
package.path = 'extensions/' .. e .. '/?.lua;' .. package.path | ||
local c = require "controllers.user" | ||
end | ||
end | ||
|
||
sailor.r = r | ||
lp.setoutfunc("page:print") | ||
|
||
|
@@ -134,6 +142,10 @@ function sailor.route(page) | |
-- Encapsulated error function for showing detailed traceback | ||
-- Needs improvement | ||
local function error_handler(msg) | ||
if sailor.conf.hide_stack_trace then | ||
page:write("<pre>Error 500: Internal Server Error</pre>") | ||
return 500 | ||
end | ||
page:write("<pre>"..traceback(msg,2).."</pre>") | ||
end | ||
-- Error for controller or action not found | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters