File tree Expand file tree Collapse file tree 2 files changed +52
-1
lines changed Expand file tree Collapse file tree 2 files changed +52
-1
lines changed Original file line number Diff line number Diff line change @@ -422,6 +422,31 @@ Check if the request has a query parameter with the given name.
422422| ---- | ------ | -------- | ------- | ----------------------------------------- |
423423| name | string | true | | The name of the query parameter to check. |
424424
425+ ##### ` setThrowOnError `
426+
427+ Sets the throw on error property for the request. If true, error codes and status
428+ will be turned in to exceptions.
429+
430+ | Name | Type | Required | Default | Description |
431+ | ---- | ------ | -------- | ------- | ----------------------------------------- |
432+ | value | boolean | true | | The value of the throw on error flag. |
433+
434+ ##### ` throwErrors `
435+
436+ A convenience method to throw on errors.
437+
438+ | Name | Type | Required | Default | Description |
439+ | ------------ | ---- | -------- | ------- | ----------- |
440+ | No arguments | | | | |
441+
442+ ##### ` allowErrors `
443+
444+ A convenience method to not throw on errors.
445+
446+ | Name | Type | Required | Default | Description |
447+ | ------------ | ---- | -------- | ------- | ----------- |
448+ | No arguments | | | | |
449+
425450##### ` setProperties `
426451
427452Quickly set many request properties using a struct. The key should be the name
Original file line number Diff line number Diff line change @@ -71,6 +71,11 @@ component accessors="true" {
7171 */
7272 property name = " queryParams" ;
7373
74+ /**
75+ * Flag to throw on a cfhttp error.
76+ */
77+ property name = " throwOnError" default = " false" ;
78+
7479 /**
7580 * Initialize a new HyperRequest.
7681 *
@@ -332,6 +337,26 @@ component accessors="true" {
332337 return this ;
333338 }
334339
340+ /**
341+ * A convenience method to not throw on errors.
342+ *
343+ * @return s The HyperRequest instance.
344+ */
345+ function allowErrors () {
346+ setThrowOnError ( false );
347+ return this ;
348+ }
349+
350+ /**
351+ * A convenience method to throw on errors.
352+ *
353+ * @return s The HyperRequest instance.
354+ */
355+ function throwErrors () {
356+ setThrowOnError ( true );
357+ return this ;
358+ }
359+
335360 /**
336361 * A convenience method to set the body format and Content-Type to json.
337362 *
@@ -557,7 +582,8 @@ component accessors="true" {
557582 method = getMethod (),
558583 redirect = false ,
559584 username = getUsername (),
560- password = getPassword ()
585+ password = getPassword (),
586+ throwonerror = getThrowOnError ()
561587 ) {
562588 for ( var name in variables .headers ) {
563589 cfhttpparam (
You can’t perform that action at this time.
0 commit comments