Error handling and debugging
Debugging tips
When integrating and using TacoTranslate, you might encounter issues. Typically, these are very easy to resolve. Here are some useful tips to help debug:
Check console logs
TacoTranslate outputs debugging information when errors occur.
Inspect network requests
Filter requests by tacotranslate
and inspect their output.
Using the error object
TacoTranslate provides an error object through the useTacoTranslate
hook, which can help you handle and debug errors. This object contains information about any errors that occur during the translation process, allowing you to respond appropriately within your application.
import {useTacoTranslate, Translate} from 'tacotranslate/react';
function Page() {
const {error} = useTacoTranslate();
return (
<div>
{error ? <div>Error: {error.message}</div> : null}
<Translate string="Hello, world!" />
</div>
);
}