Skip to content

Commit 73b1867

Browse files
committed
Update OneDriveException()
Update OneDriveException()
1 parent 9b9b0b6 commit 73b1867

1 file changed

Lines changed: 30 additions & 5 deletions

File tree

src/onedrive.d

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,51 @@ class OneDriveException : Exception {
4242
@property JSONValue error() const {
4343
return _error;
4444
}
45-
45+
4646
this(int httpStatusCode, string reason, const CurlResponse response, string file = __FILE__, size_t line = __LINE__) {
4747
this.httpStatusCode = httpStatusCode;
4848
this.response = response;
4949
this._error = response.json();
50-
50+
51+
string msg;
5152
if (this.httpStatusCode == 9999) {
52-
string msg = format("OneDrive operation failed before a valid HTTP response status was available (%s)\n%s", reason, toJSON(_error, true));
53+
msg = format(
54+
"OneDrive operation failed before a valid HTTP response status was available (%s)\n%s",
55+
reason,
56+
toJSON(_error, true)
57+
);
5358
} else {
54-
string msg = format("HTTP request returned status code %d (%s)\n%s", httpStatusCode, reason, toJSON(_error, true));
59+
msg = format(
60+
"HTTP request returned status code %d (%s)\n%s",
61+
httpStatusCode,
62+
reason,
63+
toJSON(_error, true)
64+
);
5565
}
66+
5667
super(msg, file, line);
5768
}
5869

5970
this(int httpStatusCode, string reason, string file = __FILE__, size_t line = __LINE__) {
6071
this.httpStatusCode = httpStatusCode;
6172
this.response = null;
73+
74+
string msg;
75+
if (this.httpStatusCode == 9999) {
76+
msg = format(
77+
"OneDrive operation failed before a valid HTTP response status was available (%s)",
78+
reason
79+
);
80+
} else {
81+
msg = format(
82+
"HTTP request returned status code %d (%s)",
83+
httpStatusCode,
84+
reason
85+
);
86+
}
87+
6288
super(msg, file, line);
6389
}
64-
6590
}
6691

6792
// Define the 'OneDriveError' class

0 commit comments

Comments
 (0)