Amber: Missing require for error handler

Created on 14 Jan 2018  路  4Comments  路  Source: amberframework/amber

Description

Currently when you do error scaffolding amber g error these files are created:

11:54:26 Generate   | Rendering Error Template
11:54:26 Generate   | new       src/views/error/not_found.slang
11:54:26 Generate   | new       src/views/error/internal_server_error.slang
11:54:26 Generate   | new       src/views/error/forbidden.slang
11:54:26 Generate   | new       src/handlers/error.cr
11:54:26 Generate   | new       src/controllers/error_controller.cr
11:54:26 Generate   | new       spec/controllers/error_controller_spec.cr
11:54:26 Generate   | new       spec/controllers/spec_helper.cr

but src/handlers/error.cr is doen't work because config/application.cr doen't require it

Steps to Reproduce

  1. amber new project
  2. cd project && shards
  3. amber g error
  4. amber watch
  5. open http://localhost:3000/404

Expected behavior: See 404 template working

Actual behavior: 404 Plain text page is shown instead

Reproduces how often: 100%

Versions

v0.6.3

bug

Most helpful comment

@faustinoaq There is a helper to add required dependencies. I will add a PR.

All 4 comments

The fix would consist in adding config/+application.cr to error template generator, but how can I add it just after the last require?

@faustinoaq There is a helper to add required dependencies. I will add a PR.

@faustinoaq do we want to move handlers to pipes?

@faustinoaq do we want to move handlers to pipes?

I don't know, maybe we can keep using handlers, see: https://github.com/amberframework/amber/issues/420

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bigforcegun picture bigforcegun  路  3Comments

olegsobchuk picture olegsobchuk  路  5Comments

conradwt picture conradwt  路  3Comments

yorci picture yorci  路  6Comments

elorest picture elorest  路  6Comments