Sha256: f776f400ad3f199bd53b331bf809954377aad0b9a097f035ac00519f4e719e5e

Contents?: true

Size: 386 Bytes

Versions: 1

Compression:

Stored size: 386 Bytes

Contents

Lux::Api.class_eval do

  rescue_from(:default) do |msg|
    Lux.page.status $!.class

    data =  { error:msg }

    if Lux.dev? && $!.class != StandardError
      data[:backtrace] = $!.backtrace.reject{ |el| el.index('/gems/') }.map{ |el| el.sub(Lux.root.to_s, '') }
      ap data[:backtrace]
    end

    ApplicationApi.new.decorate_response!(data)

    Lux.page.body data
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lux-fw-0.1.17 ./lib/lux/api/lib/rescue.rb