Skip to content

Improve the display of missing files#15

Merged
Vladyslav-Kuksiuk merged 3 commits intomasterfrom
improve-file-log
Apr 30, 2026
Merged

Improve the display of missing files#15
Vladyslav-Kuksiuk merged 3 commits intomasterfrom
improve-file-log

Conversation

@Vladyslav-Kuksiuk
Copy link
Copy Markdown
Collaborator

This PR improves displaying of paths, when file or fragment wasn't found.
Resolves this issue.

Possible errors:

  • When named path wasn't found:
Panic: failed to embed code fragment into doc file `file:///Users/vladyslav.kuksiuk/Desktop/Work/embed-code-go/my-test/target/target.md:2`: code root with name `first1` not found for path `$first1/hello/Hello.kt`
  • When source file was found, but fragment wasn't:
Panic: failed to embed code fragment into doc file `file:///Users/vladyslav.kuksiuk/Desktop/Work/embed-code-go/my-test/target/target.md:2`: fragment `main1` from code file `file:///Users/vladyslav.kuksiuk/Desktop/Work/embed-code-go/my-test/source/hello/Hello.kt` not found
  • When source file was not found, by named path:
Panic: failed to embed code fragment into doc file `file:///Users/vladyslav.kuksiuk/Desktop/Work/embed-code-go/my-test/target/target.md:2`: fragment `main` from code file `$first/hello/Hello2.kt (/Users/vladyslav.kuksiuk/Desktop/Work/embed-code-go/my-test/source/hello/Hello2.kt)` not found
  • When file was not found, by unnamed path:
Panic: failed to embed code fragment into doc file `file:///Users/vladyslav.kuksiuk/Desktop/Work/embed-code-go/my-test/target/target.md:2`: fragment `main` from code file `/Users/vladyslav.kuksiuk/Desktop/Work/embed-code-go/my-test/source/hello/Hello2.kt` not found

Copy link
Copy Markdown
Collaborator

@dmytro-kashcheiev dmytro-kashcheiev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Vladyslav-Kuksiuk LGTM with few comments to check before merge.

Comment thread fragmentation/fragment_file.go Outdated
Comment on lines +202 to +204
if err != nil {
panic(err)
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method by itself is a helper for logging, maybe it's not a best idea to panic if we can't formate logs correctly.

Comment thread fragmentation/fragment_file.go Outdated
Comment on lines +215 to +217
if err != nil {
panic(err)
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Comment thread fragmentation/fragment_file.go Outdated
Comment thread fragmentation/fragment_file.go Outdated
@Vladyslav-Kuksiuk Vladyslav-Kuksiuk merged commit 1cc5a23 into master Apr 30, 2026
3 checks passed
@Vladyslav-Kuksiuk Vladyslav-Kuksiuk deleted the improve-file-log branch April 30, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve diagnostics for files with named code paths

2 participants