Commit 6fefa1c 1 parent e8b53d9 commit 6fefa1c Copy full SHA for 6fefa1c
File tree 3 files changed +11
-4
lines changed
3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -12,11 +12,15 @@ public static function noHandlerFound(): self
12
12
return new static ('A runnable handler could not be found ' );
13
13
}
14
14
15
- public static function digReturnedWithError (Process $ process ): self
15
+ public static function digReturnedWithError (Process $ process, string $ command ): self
16
16
{
17
17
$ output = trim ($ process ->getErrorOutput ());
18
18
19
- return new static ("Dig command failed with message: ` {$ output }` " );
19
+ if (empty ($ output )) {
20
+ $ output = trim ($ process ->getOutput ());
21
+ }
22
+
23
+ return new static ("Dig command ` {$ command }` failed with message: ` {$ output }` " );
20
24
}
21
25
22
26
public static function dnsGetRecordReturnedWithError (string $ error ): self
Original file line number Diff line number Diff line change @@ -10,14 +10,18 @@ class Dig extends Handler
10
10
{
11
11
public function __invoke (string $ domain , int $ flag , string $ type ): array
12
12
{
13
+ $ command = $ this ->buildCommand ($ domain , $ type );
14
+
13
15
$ process = new Process ($ this ->buildCommand ($ domain , $ type ));
14
16
15
17
$ process
16
18
->enableOutput ()
17
19
->run ();
18
20
19
21
if (! $ process ->isSuccessful ()) {
20
- throw CouldNotFetchDns::digReturnedWithError ($ process );
22
+ $ command = implode (' ' , $ command );
23
+
24
+ throw CouldNotFetchDns::digReturnedWithError ($ process , $ command );
21
25
}
22
26
23
27
return $ this ->transform (
Original file line number Diff line number Diff line change @@ -145,7 +145,6 @@ public function it_uses_default_nameserver_if_not_set()
145
145
public function it_throws_exception_on_failed_to_fetch_dns_record ()
146
146
{
147
147
$ this ->expectException (CouldNotFetchDns::class);
148
- $ this ->expectExceptionMessage ("Dig command failed with message: `dig: couldn't get address for 'dns.spatie.be': not found` " );
149
148
150
149
$ this ->dns
151
150
->useNameserver ('dns.spatie.be ' )
You can’t perform that action at this time.
0 commit comments