Sha256: eb16ad2a6b517664474f977c9c0198d3962982e9c20995fb30192106f4887fee

Contents?: true

Size: 679 Bytes

Versions: 4

Compression:

Stored size: 679 Bytes

Contents

# Top-level class for all REST Framework errors.
class RESTFramework::Error < StandardError
end


class RESTFramework::NilPassedToAPIResponseError < RESTFramework::Error
  def message
    return <<~MSG.split("\n").join(' ')
      Payload of `nil` was passed to `api_response`; this is unsupported. If you want a blank
      response, pass `''` (an empty string) as the payload. If this was the result of a `find_by`
      (or similar Active Record method) not finding a record, you should use the bang version (e.g.,
      `find_by!`) to raise `ActiveRecord::RecordNotFound`, which the REST controller will catch and
      return an appropriate error response.
    MSG
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rest_framework-0.4.1 lib/rest_framework/errors.rb
rest_framework-0.4.0 lib/rest_framework/errors.rb
rest_framework-0.3.7 lib/rest_framework/errors.rb
rest_framework-0.3.6 lib/rest_framework/errors.rb