File: errors.rb

package info (click to toggle)
ruby-train 3.2.28-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 1,116 kB
  • sloc: ruby: 9,246; sh: 17; makefile: 8
file content (44 lines) | stat: -rw-r--r-- 1,267 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# encoding: utf-8
#
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
# Author:: Dominik Richter (<dominik.richter@gmail.com>)
# Author:: Christoph Hartmann (<chris@lollyrock.com>)
#
# Copyright (C) 2013, Fletcher Nichol
#
# Licensed under the Apache License, Version 2.0 (the "License");

module Train
  # Base exception for any exception explicitly raised by the Train library.
  class Error < ::StandardError
    attr_reader :reason

    def initialize(message = "", reason = :not_provided)
      super(message)
      @reason = reason
    end
  end

  # Base exception class for all exceptions that are caused by user input
  # errors.
  class UserError < Error; end

  # We could not load a plugin, because of a user error
  class PluginLoadError < UserError
    attr_accessor :transport_name
  end

  # Base exception class for all exceptions that are caused by incorrect use
  # of an API.
  class ClientError < Error; end

  # Base exception class for all exceptions that are caused by other failures
  # in the transport layer.
  class TransportError < Error; end

  # Exception for when no platform can be detected.
  class PlatformDetectionFailed < Error; end

  # Exception for when a invalid cache type is passed.
  class UnknownCacheType < Error; end
end