@@ -42,12 +42,17 @@ 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- string msg = format(" HTTP request returned status code %d (%s)\n %s" , httpStatusCode, reason, toJSON(_error, true ));
50+
51+ 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+ } else {
54+ string msg = format(" HTTP request returned status code %d (%s)\n %s" , httpStatusCode, reason, toJSON(_error, true ));
55+ }
5156 super (msg, file, line);
5257 }
5358
@@ -56,6 +61,7 @@ class OneDriveException : Exception {
5661 this .response = null ;
5762 super (msg, file, line);
5863 }
64+
5965}
6066
6167// Define the 'OneDriveError' class
@@ -2692,8 +2698,7 @@ class OneDriveApi {
26922698 } catch (FileException exception) {
26932699 // There was a file system error - display the error message
26942700 displayFileSystemErrorMessage(exception.msg, callingFunction, " " ); // as we have no file path reference here, use a blank input
2695- throw new OneDriveException(0 , " There was a file system error during OneDrive request: " ~ exception.msg, response);
2696-
2701+ throw new OneDriveException(9999 , " There was a local file system error during OneDrive request: " ~ exception.msg, response);
26972702 // A OneDriveError was thrown
26982703 } catch (OneDriveError exception) {
26992704 // Disk space error or SSL error caused a OneDriveError to be thrown
0 commit comments