Skip to content

Conversation

@m-xim
Copy link

@m-xim m-xim commented May 10, 2025

FTL file:

hello = Hello, <b>{ $firstname } { $lastname }</b>!

Before:

fluent.runtime.errors.FluentReferenceError: Unknown external: firstname

After:

aiogram_i18n.exceptions.FluentMessageError: 
2 errors for key 'hello':
  Unknown external: firstname (type=FluentReferenceError)
  Unsupported external type: lastname, <class 'NoneType'> (type=TypeError)

@m-xim
Copy link
Author

m-xim commented Jun 8, 2025

@andrew000

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves error handling for Fluent translation errors by introducing a new FluentMessageError exception that aggregates multiple errors and formats them in a user-friendly way. Instead of only raising the first error encountered during Fluent message formatting, all errors are now collected and presented together with their types.

  • Introduces FluentMessageError exception for better error reporting
  • Updates both Fluent runtime and compile cores to use the new exception
  • Fixes duplicate function names in example code

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/aiogram_i18n/exceptions.py Adds new FluentMessageError exception class with formatted multi-error output
src/aiogram_i18n/cores/fluent_runtime_core.py Updates error handling to raise FluentMessageError instead of first error only
src/aiogram_i18n/cores/fluent_compile_core.py Updates error handling to raise FluentMessageError instead of first error only
examples/language_inline_markup.py Renames duplicate function names from btn_help to btn_back and btn_lang

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@m-xim m-xim requested a review from Copilot October 23, 2025 18:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@m-xim m-xim requested a review from Copilot October 23, 2025 18:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@andrew000 andrew000 added the enhancement New feature or request label Oct 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants