Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
essenciary committed Sep 28, 2020
1 parent 821f2be commit cd9f3d8
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Millboard = "0.2"
Nettle = "0.5"
OrderedCollections = "1"
Reexport = "0.2"
Revise = "3.1"
Revise = "2, 3.1"
URIParser = "0.4"
YAML = "0.4"
julia = "1.3"
Expand Down
15 changes: 12 additions & 3 deletions src/Router.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1054,18 +1054,27 @@ Not implemented function for error response.
function error end


function trymime(mime::Any)
try
mime()
catch _
mime
end
end


function error(error_message::String, mime::Any, ::Val{500}; error_info::String = "") :: HTTP.Response
HTTP.Response(500, ["Content-Type" => string(mime())], body = "500 Internal Error - $error_message. $error_info")
HTTP.Response(500, ["Content-Type" => string(trymime(mime))], body = "500 Internal Error - $error_message. $error_info")
end


function error(error_message::String, mime::Any, ::Val{404}; error_info::String = "") :: HTTP.Response
HTTP.Response(404, ["Content-Type" => string(mime())], body = "404 Not Found - $error_message. $error_info")
HTTP.Response(404, ["Content-Type" => string(trymime(mime))], body = "404 Not Found - $error_message. $error_info")
end


function error(error_code::Int, error_message::String, mime::Any; error_info::String = "") :: HTTP.Response
HTTP.Response(error_code, ["Content-Type" => string(mime())], body = "$error_code Error - $error_message. $error_info")
HTTP.Response(error_code, ["Content-Type" => string(trymime(mime))], body = "$error_code Error - $error_message. $error_info")
end


Expand Down
1 change: 0 additions & 1 deletion src/cache_adapters/FileCache.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module FileCache

import Revise
import Serialization
import Genie, Genie.Cache

Expand Down
2 changes: 0 additions & 2 deletions src/renderers/Html.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module Html


using Revise
import Markdown, Logging, Gumbo, Reexport, OrderedCollections, Millboard, HTTP, YAML

Reexport.@reexport using Genie
Expand Down
1 change: 0 additions & 1 deletion src/renderers/Js.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module Js

import Revise
import Logging, HTTP
using Genie, Genie.Renderer

Expand Down
1 change: 0 additions & 1 deletion src/renderers/Json.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module Json

import Revise
import JSON, HTTP
using Genie, Genie.Renderer

Expand Down

2 comments on commit cd9f3d8

@essenciary
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/22115

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.2.0 -m "<description of version>" cd9f3d8f770ba31a04514e126d90257d0030e92d
git push origin v1.2.0

Please sign in to comment.