Skip to content

Commit 4ef3878

Browse files
committed
Add ClientExceptions
1 parent e5ca829 commit 4ef3878

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

lib/cortex-client.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
require 'cortex/client'
22
require 'cortex/version'
3+
require 'cortex/client_exceptions'

lib/cortex/client_exceptions.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module Cortex
2+
module ClientExceptions
3+
class ErrorFromResult < StandardError
4+
attr_accessor :status, :contents, :errors
5+
def initialize(arg)
6+
throw ArgumentError.new(msg: "Expected: Cortex::Result, Received: #{arg.class}") unless arg.is_a?(Cortex::Result)
7+
@status = arg.status
8+
@errors = arg.errors
9+
@contents = arg.contents
10+
end
11+
end
12+
end
13+
end

0 commit comments

Comments
 (0)