Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions internal/orchestrator/bricks/bricks.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,14 @@ func (s *Service) BricksDetails(id string) (BrickDetailsResult, error) {
if err != nil {
return BrickDetailsResult{}, fmt.Errorf("cannot open code examples for brick %s: %w", id, err)
}
codeExamples := f.Map(examplePaths, func(p *paths.Path) CodeExample {
return CodeExample{
Path: p.String(),
}
})
var codeExamples []CodeExample
if examplePaths != nil {
codeExamples = f.Map(examplePaths, func(p *paths.Path) CodeExample {
return CodeExample{
Path: p.String(),
}
})
}

return BrickDetailsResult{
ID: id,
Expand Down
3 changes: 3 additions & 0 deletions internal/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ func (s *StaticStore) GetBrickCodeExamplesPathFromID(brickID string) (paths.Path
targetDir := paths.New(s.codeExamplesPath, namespace, brickName)
dirEntries, err := targetDir.ReadDir()
if err != nil {
if errors.Is(err, os.ErrNotExist) {
return nil, nil
}
return nil, fmt.Errorf("cannot read examples directory %q: %w", targetDir, err)
}
return dirEntries, nil
Expand Down