bartoszherba
bartoszherba
AAlokai
Created by valerii.f on 1/15/2024 in #🙋|general-help
SDK error handling
@lucifer2732 can you share the code and reproduction steps? I can't reproduce this issue.
43 replies
AAlokai
Created by valerii.f on 1/15/2024 in #🙋|general-help
SDK error handling
yarn list --pattern @vue-storefront/middleware
43 replies
AAlokai
Created by valerii.f on 1/15/2024 in #🙋|general-help
SDK error handling
Upgrade to the latest version should fix this problem
43 replies
AAlokai
Created by valerii.f on 1/15/2024 in #🙋|general-help
SDK error handling
can you upgrade to the latest version?
43 replies
AAlokai
Created by valerii.f on 1/15/2024 in #🙋|general-help
SDK error handling
does it happen in with customized code or core?
43 replies
AAlokai
Created by valerii.f on 1/15/2024 in #🙋|general-help
SDK error handling
because graphql error is not an error that is thrown but 200 response with an error object inside, so we do not catch it
43 replies
AAlokai
Created by valerii.f on 1/15/2024 in #🙋|general-help
SDK error handling
Could you provide me with the actual code, or simplified so I can try to reproduce your issue?
43 replies
AAlokai
Created by valerii.f on 1/15/2024 in #🙋|general-help
SDK error handling
43 replies
AAlokai
Created by valerii.f on 1/15/2024 in #🙋|general-help
SDK error handling
A configurable error logger was added in 3.1.0
43 replies
AAlokai
Created by valerii.f on 1/15/2024 in #🙋|general-help
SDK error handling
Could you share middleware version that you are using?
43 replies
AAlokai
Created by valerii.f on 1/15/2024 in #🙋|general-help
SDK error handling
this way you can customize/override default logger
43 replies
AAlokai
Created by valerii.f on 1/15/2024 in #🙋|general-help
SDK error handling
const middlewareConfig = {
integrations: {
sapcc: {
location: "@vsf-enterprise/sapcc-api/server",
extensions: ...
configuration: {
// Other config
errorHandler: (error) => console.log(error), // here goes your logger
},
},
},
};
const middlewareConfig = {
integrations: {
sapcc: {
location: "@vsf-enterprise/sapcc-api/server",
extensions: ...
configuration: {
// Other config
errorHandler: (error) => console.log(error), // here goes your logger
},
},
},
};
43 replies
AAlokai
Created by valerii.f on 1/15/2024 in #🙋|general-help
SDK error handling
In the middleware.config file you can add an errorHandler key with a function
43 replies
AAlokai
Created by valerii.f on 1/15/2024 in #🙋|general-help
SDK error handling
@valerii.f ^^
43 replies
AAlokai
Created by valerii.f on 1/15/2024 in #🙋|general-help
SDK error handling
it applies to the latest middleware package
43 replies
AAlokai
Created by valerii.f on 1/15/2024 in #🙋|general-help
SDK error handling
this is the code of the default error handler, it expects an object with a message so simply throw { message: throw error.response.data.detail } instead, or add your error handler. Because this is a default handler, we do not expose any sensitive or additional data as we are not able to predict all possible data structures and its sensitivity
43 replies
AAlokai
Created by valerii.f on 1/15/2024 in #🙋|general-help
SDK error handling
if (status < 500) {
const errMsg =
error?.message ?? `Request faileds with status code ${status}`;
/**
* For all 4xx error codes or client error codes we wanted to send the error message
*/
res.send({ message: errMsg });
} else {
/**
* For all other error codes we wanted to send a generic error message
*/
res.send(
"ServerError: Something went wrong. Please, check the logs for more details."
);
}
};
if (status < 500) {
const errMsg =
error?.message ?? `Request faileds with status code ${status}`;
/**
* For all 4xx error codes or client error codes we wanted to send the error message
*/
res.send({ message: errMsg });
} else {
/**
* For all other error codes we wanted to send a generic error message
*/
res.send(
"ServerError: Something went wrong. Please, check the logs for more details."
);
}
};
43 replies
AAlokai
Created by jeanpier92 on 10/27/2023 in #🙋|general-help
error getAvailablePaymentMethods
the last one will not pass for a while because types package must be released, but you can temporary adjust the code on your side and mute ts-error there
13 replies
AAlokai
Created by jeanpier92 on 10/27/2023 in #🙋|general-help
error getAvailablePaymentMethods
13 replies
AAlokai
Created by Dmitrii72 on 5/17/2023 in #🙋|general-help
VSF2 + OpenMage
VSF2 works only with M2
5 replies