• Stephen Wilcox 3
  • NEWBIE
  • 0 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi, I'm implementing the Lightning Web Components and Salesforce Data -> Handle Server Errors part of theTrailhead module.
 
The instructions say…
Handle Errors in the accountList Component
Let’s add error handling to the accountList component that you created.
  1. In the accountList.html file, after the <template> that includes the lightning-datatable, add this code:
    <template if:true={errors}>
        <p>{errors}</p>
    </template>

    Copy
  2. Copy the ldsUtils component from LWC recipes and include it in the force-app/main/default/lwc folder in your project. This component contains the reduceErrors function.
  3. Import the reduceErrors function near the beginning of accountList.js.
    import { reduceErrors } from 'c/ldsUtils';
    Copy
  4. In accountList.js, insert this getter, which defines an errors property:
    get errors() {
        return (this.accounts.error) ?
            reduceErrors(this.accounts.error) : [];
    }

    Copy
 
 
My issue is in step 2 and 3. I copied the ldsUtils component as instructed, but following problem shows up in Visual Studio Code Output panel and I cannot deploy it to my dev instance:
 
 
=== Deploy Errors
PROJECT PATH  ERRORS                                                                                                                                         
────────────  ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
              LWC1011: Failed to resolve import "../ldsUtils/ldsUtils" from "accountList.js". Please add "../ldsUtils/ldsUtils" file to the component folder.
 
 
So I changed the import in the accountList.js from:
import { reduceErrors } from 'c/ldsUtils';
To
import { reduceErrors } from '../ldsUtils/ldsUtils';
 
The ldsUtils component is in the same component folder as the rest of my LWC components, which is:
C:\...lwc-tutorials\workingWithDataInLWC\force-app\main\default\lwc\ldsUtils
 
Any help as to what I'm doing is wrong. Thanks in advance.