Skip to main content

Debugging

Knowing how to debug errors in your theme is essential to expedite the development process. When encountering syntax errors, the terminal will often display them along with a stack trace, enabling you to pinpoint the exact cause of the error. However, it's important to note that at times, the error message may not provide the complete context or explanation.

Below are a few helpful tips to consider while building your theme.

  • Check whether you are setting the current environment before running any command.

  • Check your browser console and terminal for errors.

  • Verify if you are using the correct context.

  • Below is a list of error codes that the CLI throws, along with their descriptions:

    • FDK-001 - Current directory is not a theme directory
    • FDK-002 - Context not set
    • FDK-003 - API server error
    • FDK-004 - Something went wrong
    • FDK-005 - Invalid options passed
  • In certain cases, errors may not be displayed accurately when using server-side rendering (SSR). If you encounter this issue, it can be helpful to disable SSR and serve your theme without it. This can provide a clearer view of any errors that might be occurring. To disable SSR while serving your theme, you can modify the configuration or settings related to SSR in your development environment. By doing so, you can bypass any potential complications caused by SSR and observe the error messages directly.Remember to re-enable SSR once you have identified and resolved the error, as SSR is an important aspect of rendering your theme properly on the server-side.

  • All commands have a --verbose option to enable verbose logging. These logs are dumped in to debug.log file, which can help in debugging any issue.

  • Always keep your CLI up to date as every release brings new features and resolves bugs. Whenever a new version releases, you can see a prompt in the terminal each time a command executes successfully.


Was this section helpful?