···11require_relative 'at_handles'
22+require_relative 'errors'
23require_relative 'resolver'
34require_relative 'service_record'
45require_relative 'services'
5667module DIDKit
78 class Document
88- class FormatError < StandardError
99- end
1010-119 include AtHandles
1210 include Services
1311
+3
lib/didkit/errors.rb
···1818 response.body
1919 end
2020 end
2121+2222+ class FormatError < StandardError
2323+ end
2124end
+1-3
lib/didkit/plc_operation.rb
···11require 'time'
2233require_relative 'at_handles'
44+require_relative 'errors'
45require_relative 'service_record'
56require_relative 'services'
6778module DIDKit
89 class PLCOperation
99- class FormatError < StandardError
1010- end
1111-1210 include AtHandles
1311 include Services
1412
-3
lib/didkit/service_record.rb
···3344module DIDKit
55 class ServiceRecord
66- class FormatError < StandardError
77- end
88-96 attr_reader :key, :type, :endpoint
107118 def initialize(key, type, endpoint)
+7-7
spec/document_spec.rb
···4141 it 'should raise a format error' do
4242 expect {
4343 subject.new(did, json)
4444- }.to raise_error(DIDKit::Document::FormatError)
4444+ }.to raise_error(DIDKit::FormatError)
4545 end
4646 end
4747···5151 it 'should raise a format error' do
5252 expect {
5353 subject.new(did, json)
5454- }.to raise_error(DIDKit::Document::FormatError)
5454+ }.to raise_error(DIDKit::FormatError)
5555 end
5656 end
5757···6161 it 'should raise a format error' do
6262 expect {
6363 subject.new(did, json)
6464- }.to raise_error(DIDKit::Document::FormatError)
6464+ }.to raise_error(DIDKit::FormatError)
6565 end
6666 end
6767···7171 it 'should raise an AtHandles format error' do
7272 expect {
7373 subject.new(did, json)
7474- }.to raise_error(DIDKit::AtHandles::FormatError)
7474+ }.to raise_error(DIDKit::FormatError)
7575 end
7676 end
7777···8181 it 'should raise an AtHandles format error' do
8282 expect {
8383 subject.new(did, json)
8484- }.to raise_error(DIDKit::AtHandles::FormatError)
8484+ }.to raise_error(DIDKit::FormatError)
8585 end
8686 end
8787···106106 it 'should raise a format error' do
107107 expect {
108108 subject.new(did, json)
109109- }.to raise_error(DIDKit::Document::FormatError)
109109+ }.to raise_error(DIDKit::FormatError)
110110 end
111111 end
112112···116116 it 'should raise a format error' do
117117 expect {
118118 subject.new(did, json)
119119- }.to raise_error(DIDKit::Document::FormatError)
119119+ }.to raise_error(DIDKit::FormatError)
120120 end
121121 end
122122
+16-16
spec/plc_operation_spec.rb
···2727 let(:json) { [base_json] }
28282929 it 'should raise a format error' do
3030- expect { subject.new(json) }.to raise_error(DIDKit::PLCOperation::FormatError)
3030+ expect { subject.new(json) }.to raise_error(DIDKit::FormatError)
3131 end
3232 end
3333···3535 let(:json) { base_json.tap { |h| h.delete('did') }}
36363737 it 'should raise a format error' do
3838- expect { subject.new(json) }.to raise_error(DIDKit::PLCOperation::FormatError)
3838+ expect { subject.new(json) }.to raise_error(DIDKit::FormatError)
3939 end
4040 end
4141···4343 let(:json) { base_json.merge('did' => 123) }
44444545 it 'should raise a format error' do
4646- expect { subject.new(json) }.to raise_error(DIDKit::PLCOperation::FormatError)
4646+ expect { subject.new(json) }.to raise_error(DIDKit::FormatError)
4747 end
4848 end
4949···5151 let(:json) { base_json.merge('did' => 'foobar') }
52525353 it 'should raise a format error' do
5454- expect { subject.new(json) }.to raise_error(DIDKit::PLCOperation::FormatError)
5454+ expect { subject.new(json) }.to raise_error(DIDKit::FormatError)
5555 end
5656 end
5757···5959 let(:json) { base_json.tap { |h| h.delete('cid') }}
60606161 it 'should raise a format error' do
6262- expect { subject.new(json) }.to raise_error(DIDKit::PLCOperation::FormatError)
6262+ expect { subject.new(json) }.to raise_error(DIDKit::FormatError)
6363 end
6464 end
6565···6767 let(:json) { base_json.merge('cid' => 700) }
68686969 it 'should raise a format error' do
7070- expect { subject.new(json) }.to raise_error(DIDKit::PLCOperation::FormatError)
7070+ expect { subject.new(json) }.to raise_error(DIDKit::FormatError)
7171 end
7272 end
7373···7575 let(:json) { base_json.tap { |h| h.delete('createdAt') }}
76767777 it 'should raise a format error' do
7878- expect { subject.new(json) }.to raise_error(DIDKit::PLCOperation::FormatError)
7878+ expect { subject.new(json) }.to raise_error(DIDKit::FormatError)
7979 end
8080 end
8181···8383 let(:json) { base_json.merge('createdAt' => 123) }
84848585 it 'should raise a format error' do
8686- expect { subject.new(json) }.to raise_error(DIDKit::PLCOperation::FormatError)
8686+ expect { subject.new(json) }.to raise_error(DIDKit::FormatError)
8787 end
8888 end
8989···9191 let(:json) { base_json.tap { |h| h.delete('operation') }}
92929393 it 'should raise a format error' do
9494- expect { subject.new(json) }.to raise_error(DIDKit::PLCOperation::FormatError)
9494+ expect { subject.new(json) }.to raise_error(DIDKit::FormatError)
9595 end
9696 end
9797···9999 let(:json) { base_json.merge('operation' => 'invalid') }
100100101101 it 'should raise a format error' do
102102- expect { subject.new(json) }.to raise_error(DIDKit::PLCOperation::FormatError)
102102+ expect { subject.new(json) }.to raise_error(DIDKit::FormatError)
103103 end
104104 end
105105···107107 let(:json) { base_json.tap { |h| h['operation'].delete('type') }}
108108109109 it 'should raise a format error' do
110110- expect { subject.new(json) }.to raise_error(DIDKit::PLCOperation::FormatError)
110110+ expect { subject.new(json) }.to raise_error(DIDKit::FormatError)
111111 end
112112 end
113113···152152 it 'should raise an AtHandles format error' do
153153 expect {
154154 subject.new(json)
155155- }.to raise_error(DIDKit::AtHandles::FormatError)
155155+ }.to raise_error(DIDKit::FormatError)
156156 end
157157 end
158158···162162 it 'should raise an AtHandles format error' do
163163 expect {
164164 subject.new(json)
165165- }.to raise_error(DIDKit::AtHandles::FormatError)
165165+ }.to raise_error(DIDKit::FormatError)
166166 end
167167 end
168168···187187 let(:json) { base_json.tap { |h| h['operation'].delete('services') }}
188188189189 it 'should raise a format error' do
190190- expect { subject.new(json) }.to raise_error(DIDKit::PLCOperation::FormatError)
190190+ expect { subject.new(json) }.to raise_error(DIDKit::FormatError)
191191 end
192192 end
193193···205205 }
206206207207 it 'should raise a format error' do
208208- expect { subject.new(json) }.to raise_error(DIDKit::PLCOperation::FormatError)
208208+ expect { subject.new(json) }.to raise_error(DIDKit::FormatError)
209209 end
210210 end
211211···225225 }
226226227227 it 'should raise a format error' do
228228- expect { subject.new(json) }.to raise_error(DIDKit::PLCOperation::FormatError)
228228+ expect { subject.new(json) }.to raise_error(DIDKit::FormatError)
229229 end
230230 end
231231