Skip to content

Commit

Permalink
Prepended the throw section to include the ReferenceError related to …
Browse files Browse the repository at this point in the history
…the handler.
  • Loading branch information
galvao committed Apr 15, 2020
1 parent ad9d6e4 commit 51f54ba
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img src="media/logo.png" width="200">
<img src="media/logo.png" width="200">
</p>

# JHRW - JavaScript HTTP Request Wrapper
Expand All @@ -10,9 +10,9 @@ I've made JHRW to:

* Advance my JavaScript skills;
* Improve/Simplify the usage of the [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) object by:
* Adding default values to what's undefined;
* Adding additional Error checking and clarification;
* Adding interesting, simplified, feature, such as timeouts and retries.
* Adding default values to what's undefined;
* Adding additional Error checking and clarification;
* Adding interesting, simplified, feature, such as timeouts and retries.

## Documentation
```JavaScript
Expand All @@ -26,10 +26,12 @@ Object JHRW(String base, String urlPath [, Boolean lazyExecution = false [, Bool
* `Boolean bypassCache`(optional) - If the request URL should have a timed parameter added in order to bypass cache. Default: false

### Throws
* A `Error`
* A `ReferenceError`
* If there's no JHRWHandler function defined.
* A `Error`
* if the base parameter is `undefined`
* if the urlPath parameter is `undefined`
* A `TypeError`
* A `TypeError`
* if the base parameter is not a `String`
* if the urlPath parameter is not a `String`
* if the lazyExecution parameter is not a `Boolean`
Expand Down Expand Up @@ -98,16 +100,16 @@ or
```JavaScript
try {
var req = new JHRW('http://localhost', 'foo.php');

try {
req.init();
req.init();
} catch (ReferenceError e) {
// Do something
}
req.send();
// Do something
}

req.send();
} catch (Error e) {
// Do something
// Do something
}
```
Expand Down

0 comments on commit 51f54ba

Please sign in to comment.