Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

make example code optional for brick example details #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mirkoCrobu wants to merge 6 commits into main from issue_795_bricks_returns_500
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
View file Open in desktop
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
View file Open in desktop
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

AltStyle によって変換されたページ (->オリジナル) /