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

Support for Flame framework #454

Open
AlexWayfer opened this issue Feb 28, 2020 · 7 comments
Open

Support for Flame framework #454

AlexWayfer opened this issue Feb 28, 2020 · 7 comments

Comments

@AlexWayfer
Copy link

Hello!

I have the Flame framework (Rack-based).

And this gem does not work as middleware.

Can you please describe (add to documentation/wiki) what is required for integration? Like raising exception, or 500 status…

@RobinDaugherty
Copy link
Member

this gem does not work as middleware

Can you elaborate? BetterErrors is Rack middleware.

@AlexWayfer
Copy link
Author

AlexWayfer commented Mar 6, 2020

this gem does not work as middleware

Can you elaborate? BetterErrors is Rack middleware.

I've read this. I've added this code:

require "better_errors"

if ENV["RACK_ENV"] == "development"
  use BetterErrors::Middleware
end

And no changes, 500 is caught by Flame framework.

I've asked about documentation for framework developers, mentioned documentation looks like for users (apps developers).

@RobinDaugherty
Copy link
Member

If you're using a framework that rescues errors, then the error won't make it to the Better Errors middleware. I'm pretty sure that's what's happening here. The order of middleware is important; with Rails middleware, Better Errors has to place itself in just the right place in order to do its job.

I'm not a Rack middleware expert unfortunately, but I'll try to find time to dig into it soon.

@AlexWayfer
Copy link
Author

Thank you! I'd glad to know how to place Better Errors in the right place. I'll try to do it later with my own Rack-based framework (Flame). Probably, it should work like:

  • Code of web-app raises error
  • It goes through web-framework, through call method, to rack-middleware (Better Errors)

And currently it may fails due to rescuing errors in web-framework (Flame) without re-raising: https://github.com/AlexWayfer/flame/blob/3792cbb04d46ca8ac92a0122d4e9f7e01cae2db9/lib/flame/dispatcher/routes.rb#L33-L39

I'll check it later.

@RobinDaugherty RobinDaugherty changed the title Documentation about integration Support for Flame framework Mar 25, 2020
@AlexWayfer
Copy link
Author

OK, I actually can integrate better_errors just via re-raising exception when BetterErrors constant is defined, thank you!

Small side question: why I see "no application frames available"? Can I improve this somehow? On what it depends?

@RobinDaugherty
Copy link
Member

RobinDaugherty commented Dec 13, 2020

Application frames are determined based on BetterErrors.application_root. You can see an example of how to set this here.

@AlexWayfer
Copy link
Author

Application frames are determined based on BetterErrors.application_root. You can see an example of how to set this here.

Thank you, it seems working!

I want to add Flame to the referenced documentation, if you'd allow, if so I suggest to leave this issue open and even you can assign it to me. Ability to integration of Flame with Better Errors will be in long-awaited 5 release (there are already RC versions).

AlexWayfer added a commit to AlexWayfer/flame that referenced this issue Feb 6, 2021
More info here: BetterErrors/better_errors#454

Example:

```ruby
# config.ru

require 'better_errors'
use BetterErrors::Middleware
BetterErrors.application_root = __dir__
```

(I hope I'll not forget to add this to the wiki)
AlexWayfer added a commit to AlexWayfer/flame that referenced this issue Feb 6, 2021
More info here: BetterErrors/better_errors#454

Example:

```ruby
# config.ru

require 'better_errors'
use BetterErrors::Middleware
BetterErrors.application_root = __dir__
```

(I hope I'll not forget to add this to the wiki)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants