Response::Error and Success removed.

This commit is contained in:
Karchnu 2020-06-07 00:52:02 +02:00
parent b4f09f2efd
commit a506fced0d
6 changed files with 6 additions and 21 deletions

View File

@ -21,7 +21,7 @@ class FileStorage::Request
filestoraged.storage.download self, user_data filestoraged.storage.download self, user_data
rescue e rescue e
return Response::Error.new @mid, "unauthorized" return Errors::GenericError.new @mid, e.to_s
end end
end end
FileStorage.requests << Download FileStorage.requests << Download

View File

@ -28,7 +28,7 @@ class FileStorage::Request
return Response::Login.new @mid return Response::Login.new @mid
rescue e rescue e
return Response::Error.new @mid, "unauthorized" return Errors::GenericError.new @mid, "unauthorized"
end end
end end
FileStorage.requests << Login FileStorage.requests << Login

View File

@ -29,7 +29,7 @@ class FileStorage::Request
filestoraged.storage.write_chunk self, user_data filestoraged.storage.write_chunk self, user_data
rescue e rescue e
return Response::Error.new @mid, "unauthorized" return Errors::GenericError.new @mid, e.to_s
end end
end end
FileStorage.requests << PutChunk FileStorage.requests << PutChunk
@ -55,7 +55,7 @@ class FileStorage::Request
filestoraged.storage.read_chunk self, user_data filestoraged.storage.read_chunk self, user_data
rescue e rescue e
return Response::Error.new @mid, "unauthorized" return Errors::GenericError.new @mid, e.to_s
end end
end end
FileStorage.requests << GetChunk FileStorage.requests << GetChunk

View File

@ -19,7 +19,7 @@ class FileStorage::Request
filestoraged.storage.upload self, user_data filestoraged.storage.upload self, user_data
rescue e rescue e
return Response::Error.new @mid, "unauthorized" return Errors::GenericError.new @mid, e.to_s
end end
end end
FileStorage.requests << Upload FileStorage.requests << Upload

View File

@ -157,7 +157,7 @@ class FileStorage::Service < IPC::Service
if response.responds_to?(:reason) if response.responds_to?(:reason)
warning ">> #{response_type.sub /^FileStorage::Errors::/, ""} (#{response.reason})" warning ">> #{response_type.sub /^FileStorage::Errors::/, ""} (#{response.reason})"
else else
info ">> #{response.class.name.sub /^FileStorage::Response::/, ""}" info ">> #{response_type.sub /^FileStorage::Response::/, ""}"
end end
################################################################# #################################################################

View File

@ -45,21 +45,6 @@ class FileStorage::Client < IPC::Client
end end
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? def parse_message(requests : Array(JSONIPC.class), message : IPC::Message) : JSONIPC?
request_type = requests.find &.type.==(message.utype) request_type = requests.find &.type.==(message.utype)