[ddc] Append hot restart instruction to hot reload rejection reasons.

By adding this message here, any entrypoint that makes use of this for hot reload (e.g. DartPad, Flutter tools/FE server) will all surface this same message. This probably easier than having each one try to detect errors and append its own message.

Change-Id: I5980d530b66da818e29403cc13407095d8b203dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408380
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
Nate Biggs
2025-02-07 10:20:53 -08:00
committed by Commit Queue
parent 89e545c5cc
commit 89af2425f2
2 changed files with 7 additions and 2 deletions
@@ -374,7 +374,8 @@ Future<CompilerResult> _compile(List<String> args,
lastAcceptedComponent, compiledLibraries);
if (rejectionReasons.isNotEmpty) {
throw StateError(
'Hot reload rejected due to:\n${rejectionReasons.join('\n')}');
'Hot reload rejected due to:\n${rejectionReasons.join('\n')}\n'
'Use hot restart instead.');
}
}
var sink = File(reloadDeltaKernel).openWrite();
@@ -90,7 +90,11 @@ class IncrementalJavaScriptBundler {
// connected component graph.
final List<String> errors = _deltaInspector.compareGenerations(
lastFullComponent, partialComponent);
if (errors.isNotEmpty) throw new Exception(errors.join('/n'));
if (errors.isNotEmpty) {
throw new Exception(errors.join('/n') +
'\nHot reload rejected due to unsupported changes. '
'Use hot restart instead.');
}
}
_currentComponent = partialComponent;
_updateFullComponent(lastFullComponent, partialComponent);