Response::Error and Success removed.
parent
b4f09f2efd
commit
a506fced0d
|
@ -21,7 +21,7 @@ class FileStorage::Request
|
|||
|
||||
filestoraged.storage.download self, user_data
|
||||
rescue e
|
||||
return Response::Error.new @mid, "unauthorized"
|
||||
return Errors::GenericError.new @mid, e.to_s
|
||||
end
|
||||
end
|
||||
FileStorage.requests << Download
|
||||
|
|
|
@ -28,7 +28,7 @@ class FileStorage::Request
|
|||
|
||||
return Response::Login.new @mid
|
||||
rescue e
|
||||
return Response::Error.new @mid, "unauthorized"
|
||||
return Errors::GenericError.new @mid, "unauthorized"
|
||||
end
|
||||
end
|
||||
FileStorage.requests << Login
|
||||
|
|
|
@ -29,7 +29,7 @@ class FileStorage::Request
|
|||
|
||||
filestoraged.storage.write_chunk self, user_data
|
||||
rescue e
|
||||
return Response::Error.new @mid, "unauthorized"
|
||||
return Errors::GenericError.new @mid, e.to_s
|
||||
end
|
||||
end
|
||||
FileStorage.requests << PutChunk
|
||||
|
@ -55,7 +55,7 @@ class FileStorage::Request
|
|||
|
||||
filestoraged.storage.read_chunk self, user_data
|
||||
rescue e
|
||||
return Response::Error.new @mid, "unauthorized"
|
||||
return Errors::GenericError.new @mid, e.to_s
|
||||
end
|
||||
end
|
||||
FileStorage.requests << GetChunk
|
||||
|
|
|
@ -19,7 +19,7 @@ class FileStorage::Request
|
|||
|
||||
filestoraged.storage.upload self, user_data
|
||||
rescue e
|
||||
return Response::Error.new @mid, "unauthorized"
|
||||
return Errors::GenericError.new @mid, e.to_s
|
||||
end
|
||||
end
|
||||
FileStorage.requests << Upload
|
||||
|
|
|
@ -157,7 +157,7 @@ class FileStorage::Service < IPC::Service
|
|||
if response.responds_to?(:reason)
|
||||
warning ">> #{response_type.sub /^FileStorage::Errors::/, ""} (#{response.reason})"
|
||||
else
|
||||
info ">> #{response.class.name.sub /^FileStorage::Response::/, ""}"
|
||||
info ">> #{response_type.sub /^FileStorage::Response::/, ""}"
|
||||
end
|
||||
|
||||
#################################################################
|
||||
|
|
|
@ -45,21 +45,6 @@ class FileStorage::Client < IPC::Client
|
|||
end
|
||||
end
|
||||
|
||||
class FileStorage::Response
|
||||
JSONIPC.request Error, 0 do
|
||||
property mid : String
|
||||
property reason : String | Array(String)
|
||||
|
||||
def initialize(@mid, @reason)
|
||||
end
|
||||
end
|
||||
JSONIPC.request Success, 1 do
|
||||
property mid : String
|
||||
def initialize(@mid)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def parse_message(requests : Array(JSONIPC.class), message : IPC::Message) : JSONIPC?
|
||||
request_type = requests.find &.type.==(message.utype)
|
||||
|
||||
|
|
Loading…
Reference in New Issue