File tree Expand file tree Collapse file tree 3 files changed +31
-16
lines changed Expand file tree Collapse file tree 3 files changed +31
-16
lines changed Original file line number Diff line number Diff line change 1- import { axios } from "@pipedream/platform" ;
1+ import {
2+ axios , ConfigurationError ,
3+ } from "@pipedream/platform" ;
24
35export default {
46 type : "app" ,
57 app : "elmah_io" ,
68 propDefinitions : {
79 logId : {
810 label : "Log ID" ,
9- description : "The ID of the log" ,
11+ description : "The ID of the log. Requires that your api key have the `logs_read` permission. " ,
1012 type : "string" ,
1113 async options ( ) {
1214 const logs = await this . getLogs ( ) ;
1315
14- return logs . map ( ( log ) => ( {
16+ return logs ? .map ( ( log ) => ( {
1517 label : log . name ,
1618 value : log . id ,
17- } ) ) ;
19+ } ) ) || [ ] ;
1820 } ,
1921 } ,
2022 } ,
@@ -28,14 +30,22 @@ export default {
2830 async _makeRequest ( {
2931 $ = this , path, ...args
3032 } ) {
31- return axios ( $ , {
32- ...args ,
33- url : `${ this . _apiUrl ( ) } ${ path } ` ,
34- params : {
35- ...args ?. params ,
36- api_key : this . _apiKey ( ) ,
37- } ,
38- } ) ;
33+ try {
34+ return await axios ( $ , {
35+ ...args ,
36+ url : `${ this . _apiUrl ( ) } ${ path } ` ,
37+ params : {
38+ ...args ?. params ,
39+ api_key : this . _apiKey ( ) ,
40+ } ,
41+ } ) ;
42+ } catch ( error ) {
43+ if ( error . response ?. status === 401 ) {
44+ console . log ( error ) ;
45+ throw new ConfigurationError ( `${ error . response . data . title } ${ error . response . data . detail } ` ) ;
46+ }
47+ throw error ;
48+ }
3949 } ,
4050 async getLogs ( args = { } ) {
4151 return this . _makeRequest ( {
Original file line number Diff line number Diff line change 11{
22 "name" : " @pipedream/elmah_io" ,
3- "version" : " 0.0.4 " ,
3+ "version" : " 0.0.5 " ,
44 "description" : " Pipedream elmah.io Components" ,
55 "main" : " elmah_io.app.mjs" ,
66 "keywords" : [
1414 "access" : " public"
1515 },
1616 "dependencies" : {
17- "@pipedream/platform" : " ^1.2 .0"
17+ "@pipedream/platform" : " ^3.1 .0"
1818 }
1919}
Original file line number Diff line number Diff line change @@ -6,9 +6,9 @@ const QUERY = "isNew:true AND (severity:Error OR severity:Fatal)";
66
77export default {
88 name : "New Error" ,
9- version : "0.0.3 " ,
9+ version : "0.0.4 " ,
1010 key : "elmah_io-new-error" ,
11- description : "Emit new event on each new error" ,
11+ description : "Emit new event on each new error. [See the documentation](https://api.elmah.io/swagger/index.html#/Messages/Messages_GetAll) " ,
1212 type : "source" ,
1313 dedupe : "unique" ,
1414 props : {
@@ -26,6 +26,11 @@ export default {
2626 "logId" ,
2727 ] ,
2828 } ,
29+ alert : {
30+ type : "alert" ,
31+ alertType : "info" ,
32+ content : "Note: This source requires that your api key have the `logs_read` and `messages_read` permissions." ,
33+ } ,
2934 } ,
3035 methods : {
3136 emitEvent ( event ) {
You can’t perform that action at this time.
0 commit comments