ਗਲਤੀ ਸੰਭਾਲ ਅਤੇ ਡਿਬੱਗਿੰਗ
ਡਿਬੱਗਿੰਗ ਸੁਝਾਅ
When integrating and using TacoTranslate, you might encounter issues. It’s important to note that the default behavior of TacoTranslate is to just display the initial text whenever an error occurs. No errors will be thrown or otherwise break your application.
Typically, though, issues 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.
ਏਰਰ ਆਬਜੈਕਟ ਦੀ ਵਰਤੋਂ
TacoTranslate useTacoTranslate ਹੂਕ ਰਾਹੀਂ ਇੱਕ ਐਰਰ ਆਬਜੈਕਟ ਪ੍ਰਦਾਨ ਕਰਦਾ ਹੈ, ਜੋ ਤੁਹਾਨੂੰ ਐਰਰਾਂ ਨੂੰ ਸੰਭਾਲਣ ਅਤੇ ਡਿਬੱਗ ਕਰਨ ਵਿੱਚ ਮਦਦ ਕਰ ਸਕਦਾ ਹੈ। ਇਹ ਆਬਜੈਕਟ ਅਨੁਵਾਦ ਪ੍ਰਕਿਰਿਆ ਦੌਰਾਨ ਹੋਣ ਵਾਲੀਆਂ ਕਿਸੇ ਵੀ ਤ੍ਰੁਟੀਆਂ ਬਾਰੇ ਜਾਣਕਾਰੀ ਰੱਖਦਾ ਹੈ, ਜਿਸ ਨਾਲ ਤੁਸੀਂ ਆਪਣੀ ਐਪਲੀਕੇਸ਼ਨ ਵਿੱਚ ਉਚਿਤ ਤਰੀਕੇ ਨਾਲ ਪ੍ਰਤੀਕ੍ਰਿਆ ਦੇ ਸਕਦੇ ਹੋ।
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>
);
}