Надеюсь, эта библиотека поможет вам - https://github.com/cypress-io/error-message
Вот суть,
//Load the function from the module
const {formErrorText} = require('@cypress/error-message')
//Handle the error with custome messages
const fileSaveError = {
description: 'We could not save an important file',
solution: `Please check folder permissions and try again
more details on our FAQ page: https://faq.company.name
`
}
fs.writeFile(name)
.catch(
formErrorText(info).then(console.error)
)
/*
shows nice error message
------
We could not save an important file
Please check folder permissions and try again
more details on our FAQ page: https://faq.company.name
Exception message
------
Platform: darwin
Version: 15.6.2
*/
Для получения дополнительной информации, вы можете проверить этот блог - https://www.cypress.io/blog/2017/07/26/good-error-messages/#Useful-E2E-assertion-failures
Редактировать 1:
Как указано в комментарии, если вы ищете для обработки таинственных сбоев, предложите вам взглянуть на Механизм обработки событий Cypress . Вот выдержка из этого,
// likely want to do this in a support file
// so it's applied to all spec files
// cypress/support/index.js
Cypress.on('uncaught:exception', (err, runnable) => {
// Handle your logging logic here
})