Closed gaudes closed 3 years ago
Please provide more information to reproduce it:
hafas-client
versionThe hafas-client
errors have many additional properties, so if you log them properly (e.g. using the built-in console.error
or a logger like bunyan
), there should be additional fields that five more context.
As an example, I'm going to provoke an error by purposefully sending an invalid request:
const createClient = require('hafas-client')
const oebbProfile = require('hafas-client/p/oebb')
const client = createClient({
...oebbProfile,
transformReqBody: (ctx, body) => ({
...body,
'foo': 'invalid',
}),
}, 'broken client example')
client.journeys('1291501', '8100002', {results: 1})
.catch(err => console.error(err))
console.error(err)
will print all error fields as well:
Error: Parser error: root(foo)
at Object.request (/Users/j/web/hafas-client/lib/request.js:109:14)
at Object.journeys (/Users/j/web/hafas-client/index.js:212:18)
at Object.<anonymous> (/Users/j/web/hafas-client/foo.js:14:8)
at Module._compile (node:internal/modules/cjs/loader:1109:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
at Module.load (node:internal/modules/cjs/loader:989:32)
at Function.Module._load (node:internal/modules/cjs/loader:829:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47 {
isHafasError: true,
request: '{"lang":"de","svcReqL":[{"cfg":{"polyEnc":"GPA"},"meth":"TripSearch","req":{"getPasslist":false,"maxChg":-1,"minChgTime":0,"depLocL":[{"type":"S","lid":"A=1@L=1291501@"}],"viaLocL":null,"arrLocL":[{"type":"S","lid":"A=1@L=8100002@"}],"jnyFltrL":[{"type":"PROD","mode":"INC","value":"7167"},{"type":"META","mode":"INC","meta":"notBarrierfree"}],"gisFltrL":[],"getTariff":false,"ushrp":true,"getPT":true,"getIV":false,"getPolyline":false,"outDate":"20210607","outTime":"231159","numF":1,"outFrwd":true}}],"foo":"invalid","client":{"type":"IPH","id":"OEBB","v":"6030600","name":"oebbPROD-ADHOC"},"ver":"1.41","auth":{"type":"AID","aid":"OWDL4fE4ixNiPBBm"}}',
url: 'https://fahrplan.oebb.at/bin/mgate.exe?',
statusCode: 200,
code: 'PARSE',
responseId: null
}
It would be great if you could adapt your logging setup in ioBroker.fahrplan
to log the fields, so that you can supply them here in bug reports!
Hey Janis,
I've talked to end user: Problem seems to be gone at the moment.
We're using Sentry for error reporting in ioBroker.
I've integrated the properties of the error object you mentioned above.
Next time I'll get the information when the user uses the new version of my project.
For now, I will close this issue and reopen a new one with more information if the error occurs again.
In the future, due to better HAFAS-error handling with Sentry, I'll get the HAFAS errors directly by Sentry.
Thanks and kind regards,
Ralf
Hi Janis,
a user reports since today again error message with OEBB profile:
Error at HAFAS (Parser error: root.svcResL.svcResL.res.common.rtSrcL.rtSrcL.type)
Any ideas ?
Thanks and regards,
Ralf