Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
walint
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
hub
walint
Commits
e5adcba7
Commit
e5adcba7
authored
3 years ago
by
stuebinm
Browse files
Options
Downloads
Patches
Plain Diff
cwality-maps: better logging
parent
4324662b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cwality-maps/Main.hs
+11
-5
11 additions, 5 deletions
cwality-maps/Main.hs
package.yaml
+1
-0
1 addition, 0 deletions
package.yaml
walint.cabal
+1
-0
1 addition, 0 deletions
walint.cabal
with
13 additions
and
5 deletions
cwality-maps/Main.hs
+
11
−
5
View file @
e5adcba7
...
...
@@ -44,6 +44,9 @@ import Servant.Server.StaticFiles (serveDirectoryWebApp)
import
Substitute
(
Substitutable
(
substitute
),
SubstitutionError
)
import
Control.Monad.Logger
-- | a map's filename ending in .json
-- (a newtype to differentiate between maps and assets in a route)
newtype
JsonFilename
=
JsonFilename
Text
...
...
@@ -87,14 +90,15 @@ mkMap :: Config True -> Tiledmap -> MapParams -> ([SubstitutionError], Tiledmap)
mkMap
_config
basemap
params
=
substitute
basemap
(
substs
params
)
mapHandler
::
Config
True
->
JsonFilename
->
MapParams
->
Handler
Tiledmap
mapHandler
config
(
JsonFilename
mapname
)
params
=
case
M
.
lookup
mapname
(
snd
$
view
template
config
)
of
Just
basemap
->
do
let
(
errors
,
map
)
=
mkMap
config
basemap
params
print
errors
pure
map
Just
basemap
->
runStdoutLoggingT
$
logWarnN
(
pretty
errors
)
>>
pure
tiledmap
where
(
errors
,
tiledmap
)
=
mkMap
config
basemap
params
pretty
errors
=
T
.
concat
.
intersperse
"
\n
"
$
concatMap
(
lines
.
show
)
errors
Nothing
->
throwError
err404
-- | Complete set of routes: API + HTML sites
...
...
@@ -106,6 +110,8 @@ server config = mapHandler config
app
::
Config
True
->
Application
app
=
serve
(
Proxy
@
Routes
)
.
server
main
::
IO
()
main
=
do
config
<-
loadConfig
"./cwality-config.toml"
...
...
This diff is collapsed.
Click to expand it.
package.yaml
+
1
−
0
View file @
e5adcba7
...
...
@@ -72,6 +72,7 @@ executables:
-
wai
-
wai-extra
-
warp
-
monad-logger
-
fmt
-
tomland
-
microlens-platform
...
...
This diff is collapsed.
Click to expand it.
walint.cabal
+
1
−
0
View file @
e5adcba7
...
...
@@ -99,6 +99,7 @@ executable cwality-maps
, filepath
, fmt
, microlens-platform
, monad-logger
, mustache
, parsec
, servant
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment