Skip to content

refactor(dart): merge all runtime exceptions into single fory_exception.dart#3436

Merged
chaokunyang merged 2 commits intoapache:mainfrom
yash-agarwa-l:merge_excep
Feb 28, 2026
Merged

refactor(dart): merge all runtime exceptions into single fory_exception.dart#3436
chaokunyang merged 2 commits intoapache:mainfrom
yash-agarwa-l:merge_excep

Conversation

@yash-agarwa-l
Copy link
Contributor

@yash-agarwa-l yash-agarwa-l commented Feb 28, 2026

Why?

The current Dart exception hierarchy spreads runtime exceptions across four separate files under dart/packages/fory/lib/src/exception/, which is overly Java-style for idiomatic Dart.

What needs to be done?

  • Merge all runtime exception classes from:

    • exception/**
    • codegen/exception/**
      into a single file: dart/packages/fory/lib/src/fory_exception.dart
  • Update all imports across serializers, resolvers, context, and codegen base to point to the new file.

  • Delete the exception/ subdirectory and the codegen/exception/ subdirectory.

Does this introduce any user-facing change?

  • Does this introduce any public API change? (import paths change)
  • Does this introduce any binary protocol compatibility change?

Related

@chaokunyang
Copy link
Collaborator

@yash-agarwa-l Please address conflict first

@yash-agarwa-l
Copy link
Contributor Author

Resolved and rebased to the main.

import 'package:fory/src/exception/fory_exception.dart';
import 'package:fory/src/fory_exception.dart';

abstract class ForyCodegenException extends ForyException {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could this merged into fory_exception.dart ?

@yash-agarwa-l
Copy link
Contributor Author

PTAL, They are merged now. Also I have renamed the UnsupportedTypeException of the codegen folder to CodegenUnsupportedTypeException because of a overlap.

Copy link
Collaborator

@chaokunyang chaokunyang left a comment

Choose a reason for hiding this comment

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

LGTM

@chaokunyang chaokunyang merged commit 22bae97 into apache:main Feb 28, 2026
59 checks passed
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.

2 participants