انتقل إلى المحتوى
أمين أبوزيد
درس مخطط لهMID-006-L03

الأخطاء في الشيفرة غير المتزامنة

  • الدرس 3 من 6
  • Mid-level
في هذا الدرس 4 موضوعات

هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

في هذا الدرس

propagate and handle failures.

الموضوعات المخطط لها

  • An exception completes the stage exceptionally; dependent stages are skipped and carry it forward.
  • exceptionally(fn): recover with a fallback value.
  • handle((v, ex) -> ...): see both result and error; whenComplete observes without changing.
  • join() throws CompletionException; get() throws ExecutionException; the cause is wrapped.
  • An unobserved failed future loses the error silently; always attach handling or read it.
تفاصيل المخطط المبدئي

عرض عملي

java
CompletableFuture<List<Review>> r = reviewsF.exceptionally(ex -> List.of()); // degrade gracefully

اختبر فهمك

What does a downstream thenApply do when its source failed?

أظهر الإجابة

It is skipped and the failure propagates.

التطبيق

طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.

المختبر والتمارين الاختبار

تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.

اكتب للبحث في المستويات والمراحل والوحدات والدروس.