Class: Faye::Error

Inherits:
Object
  • Object
show all
Defined in:
lib/faye/error.rb

Constant Summary collapse

VERSION_MISMATCH =
[300, 'Version mismatch']
CONNTYPE_MISMATCH =
[301, 'Connection types not supported']
EXT_MISMATCH =
[302, 'Extension mismatch']
BAD_REQUEST =
[400, 'Bad request']
CLIENT_UNKNOWN =
[401, 'Unknown client']
PARAMETER_MISSING =
[402, 'Missing required parameter']
CHANNEL_FORBIDDEN =
[403, 'Forbidden channel']
CHANNEL_UNKNOWN =
[404, 'Unknown channel']
CHANNEL_INVALID =
[405, 'Invalid channel']
EXT_UNKNOWN =
[406, 'Unknown extension']
PUBLISH_FAILED =
[407, 'Failed to publish']
SERVER_ERROR =
[500, 'Internal server error']

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, args, message) ⇒ Error

Returns a new instance of Error.



11
12
13
14
15
# File 'lib/faye/error.rb', line 11

def initialize(code, args, message)
  @code     = code
  @args     = args
  @message  = message
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



9
10
11
# File 'lib/faye/error.rb', line 9

def args
  @args
end

#codeObject (readonly)

Returns the value of attribute code.



9
10
11
# File 'lib/faye/error.rb', line 9

def code
  @code
end

#messageObject (readonly)

Returns the value of attribute message.



9
10
11
# File 'lib/faye/error.rb', line 9

def message
  @message
end

Class Method Details

.method_missing(type, *args) ⇒ Object



4
5
6
7
# File 'lib/faye/error.rb', line 4

def self.method_missing(type, *args)
  code = const_get(type.to_s.upcase)
  new(code[0], args, code[1]).to_s
end

Instance Method Details

#to_sObject



17
18
19
# File 'lib/faye/error.rb', line 17

def to_s
  "#{ @code }:#{ @args * ',' }:#{ @message }"
end