piloterr 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +539 -0
- data/examples/README.md +12 -0
- data/examples/binary.rb +12 -0
- data/examples/json.rb +8 -0
- data/examples/request.rb +11 -0
- data/examples/wait_for_job.rb +8 -0
- data/lib/piloterr/client.rb +266 -0
- data/lib/piloterr/endpoints.rb +2753 -0
- data/lib/piloterr/errors.rb +56 -0
- data/lib/piloterr/operations.rb +6097 -0
- data/lib/piloterr/responses.rb +45 -0
- data/lib/piloterr/serialization.rb +66 -0
- data/lib/piloterr/transport.rb +27 -0
- data/lib/piloterr/version.rb +5 -0
- data/lib/piloterr.rb +14 -0
- data/sig/piloterr.rbs +470 -0
- metadata +66 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Piloterr
|
|
4
|
+
# Base class for every SDK-defined error.
|
|
5
|
+
class Error < StandardError; end
|
|
6
|
+
|
|
7
|
+
# The client configuration is missing or unusable.
|
|
8
|
+
class ConfigurationError < Error; end
|
|
9
|
+
|
|
10
|
+
# A request value cannot be represented safely on the wire.
|
|
11
|
+
class SerializationError < Error
|
|
12
|
+
attr_reader :param
|
|
13
|
+
|
|
14
|
+
def initialize(message, param = nil)
|
|
15
|
+
super(message)
|
|
16
|
+
@param = param
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# The request failed before a complete HTTP response was received.
|
|
21
|
+
class TransportError < Error; end
|
|
22
|
+
|
|
23
|
+
# Piloterr returned a non-success HTTP status.
|
|
24
|
+
class APIError < Error
|
|
25
|
+
attr_reader :status, :error_message, :response_body, :raw_response
|
|
26
|
+
|
|
27
|
+
def initialize(raw_response:, response_body: nil, error_message: nil)
|
|
28
|
+
super(error_message || "Piloterr API request failed with status #{raw_response.status}.")
|
|
29
|
+
@status = raw_response.status
|
|
30
|
+
@error_message = error_message
|
|
31
|
+
@response_body = response_body
|
|
32
|
+
@raw_response = raw_response
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# A successful response could not be decoded as the documented representation.
|
|
37
|
+
class ResponseDecodingError < Error
|
|
38
|
+
attr_reader :raw_response
|
|
39
|
+
|
|
40
|
+
def initialize(message, raw_response)
|
|
41
|
+
super(message)
|
|
42
|
+
@raw_response = raw_response
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# An async job did not reach a terminal status before the deadline.
|
|
47
|
+
class JobTimeoutError < Error
|
|
48
|
+
attr_reader :job_id, :last_response
|
|
49
|
+
|
|
50
|
+
def initialize(job_id, last_response = nil)
|
|
51
|
+
super("Job #{job_id} did not finish before the deadline.")
|
|
52
|
+
@job_id = job_id
|
|
53
|
+
@last_response = last_response
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|