|
| 1 | +<!DOCTYPE HTML> |
| 2 | +<html lang> |
| 3 | +<head> |
| 4 | +<!-- Generated by javadoc (25) on Tue Jun 02 15:10:07 UTC 2026 --> |
| 5 | +<title>EventErrorHandler (GitHub Copilot SDK for Java — Documentation Site 1.0.0 API)</title> |
| 6 | +<meta name="viewport" content="width=device-width, initial-scale=1"> |
| 7 | +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| 8 | +<meta name="dc.created" content="2026-06-02"> |
| 9 | +<meta name="description" content="declaration: module: com.github.copilot.java, package: com.github.copilot, interface: EventErrorHandler"> |
| 10 | +<meta name="generator" content="javadoc/ClassWriter"> |
| 11 | +<link rel="stylesheet" type="text/css" href="../../../../resource-files/jquery-ui.min.css"> |
| 12 | +<link rel="stylesheet" type="text/css" href="../../../../resource-files/stylesheet.css"> |
| 13 | +<script type="text/javascript" src="../../../../script-files/script.js"></script> |
| 14 | +<script type="text/javascript" src="../../../../script-files/jquery-3.7.1.min.js"></script> |
| 15 | +<script type="text/javascript" src="../../../../script-files/jquery-ui.min.js"></script> |
| 16 | +</head> |
| 17 | +<body class="class-declaration-page"> |
| 18 | +<script type="text/javascript">const pathtoroot = "../../../../"; |
| 19 | +loadScripts(document, 'script');</script> |
| 20 | +<noscript> |
| 21 | +<div>JavaScript is disabled on your browser.</div> |
| 22 | +</noscript> |
| 23 | +<header role="banner"> |
| 24 | +<nav role="navigation"> |
| 25 | +<!-- ========= START OF TOP NAVBAR ======= --> |
| 26 | +<div class="top-nav" id="navbar-top"> |
| 27 | +<div class="nav-content"> |
| 28 | +<div class="nav-menu-button"><button id="navbar-toggle-button" aria-controls="navbar-top" aria-expanded="false" aria-label="Toggle navigation links"><span class="nav-bar-toggle-icon"> </span><span class="nav-bar-toggle-icon"> </span><span class="nav-bar-toggle-icon"> </span></button></div> |
| 29 | +<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div> |
| 30 | +<ul id="navbar-top-firstrow" class="nav-list" title="Navigation"> |
| 31 | +<li><a href="../../../module-summary.html">Module</a></li> |
| 32 | +<li class="nav-bar-cell1-rev">Class</li> |
| 33 | +<li><a href="class-use/EventErrorHandler.html">Use</a></li> |
| 34 | +<li><a href="package-tree.html">Tree</a></li> |
| 35 | +<li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| 36 | +<li><a href="../../../../index-all.html">Index</a></li> |
| 37 | +<li><a href="../../../../search.html">Search</a></li> |
| 38 | +<li><a href="../../../../help-doc.html#class">Help</a></li> |
| 39 | +</ul> |
| 40 | +</div> |
| 41 | +</div> |
| 42 | +<div class="sub-nav"> |
| 43 | +<div class="nav-content"> |
| 44 | +<ol class="sub-nav-list"> |
| 45 | +<li><a href="../../../module-summary.html">com.github.copilot.java</a></li> |
| 46 | +<li><a href="package-summary.html">com.github.copilot</a></li> |
| 47 | +<li><a href="EventErrorHandler.html" class="current-selection">EventErrorHandler</a></li> |
| 48 | +</ol> |
| 49 | +<div class="nav-list-search"><input type="text" id="search-input" disabled placeholder="Search documentation (type /)" aria-label="Search in documentation" autocomplete="off" spellcheck="false"><input type="reset" id="reset-search" disabled value="Reset"></div> |
| 50 | +</div> |
| 51 | +</div> |
| 52 | +<!-- ========= END OF TOP NAVBAR ========= --> |
| 53 | +<span class="skip-nav" id="skip-navbar-top"></span></nav> |
| 54 | +</header> |
| 55 | +<div class="main-grid"> |
| 56 | +<nav role="navigation" class="toc" aria-label="Table of contents"> |
| 57 | +<div class="toc-header">Contents <input type="text" class="filter-input" disabled placeholder="Filter contents (type .)" aria-label="Filter table of contents" autocomplete="off" spellcheck="false"><input type="reset" class="reset-filter" disabled tabindex="-1" value="Reset"></div> |
| 58 | +<ol class="toc-list" tabindex="-1"> |
| 59 | +<li><a href="#" tabindex="0">Description</a></li> |
| 60 | +<li><a href="#method-summary" tabindex="0">Method Summary</a></li> |
| 61 | +<li><a href="#method-detail" tabindex="0">Method Details</a> |
| 62 | +<ol class="toc-list"> |
| 63 | +<li><a href="#handleError(com.github.copilot.generated.SessionEvent,java.lang.Exception)" tabindex="0">handleError(SessionEvent, Exception)</a></li> |
| 64 | +</ol> |
| 65 | +</li> |
| 66 | +</ol> |
| 67 | +<button class="hide-sidebar"><span>Hide sidebar </span><img src="../../../../resource-files/left.svg" alt="Hide sidebar"></button><button class="show-sidebar"><img src="../../../../resource-files/right.svg" alt="Show sidebar"><span> Show sidebar</span></button></nav> |
| 68 | +<main role="main"> |
| 69 | +<!-- ======== START OF CLASS DATA ======== --> |
| 70 | +<div class="header"> |
| 71 | +<h1 title="Interface EventErrorHandler" class="title">Interface EventErrorHandler</h1> |
| 72 | +</div> |
| 73 | +<section class="class-description" id="class-description"> |
| 74 | +<dl class="notes"> |
| 75 | +<dt>Functional Interface:</dt> |
| 76 | +<dd>This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.</dd> |
| 77 | +</dl> |
| 78 | +<hr> |
| 79 | +<div class="horizontal-scroll"> |
| 80 | +<div class="type-signature"><span class="annotations"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/FunctionalInterface.html" title="class or interface in java.lang" class="external-link">@FunctionalInterface</a> |
| 81 | +</span><span class="modifiers">public interface </span><span class="element-name type-name-label">EventErrorHandler</span></div> |
| 82 | +<div class="block">A handler for errors thrown by event handlers during event dispatch. |
| 83 | +<p> |
| 84 | +When an event handler registered via |
| 85 | +<a href="CopilotSession.html#on(java.util.function.Consumer)"><code>CopilotSession.on(java.util.function.Consumer)</code></a> or |
| 86 | +<a href="CopilotSession.html#on(java.lang.Class,java.util.function.Consumer)"><code>CopilotSession.on(Class, java.util.function.Consumer)</code></a> throws an |
| 87 | +exception, the <code>EventErrorHandler</code> is invoked with the event that was |
| 88 | +being dispatched and the exception that was thrown. |
| 89 | + |
| 90 | +<p> |
| 91 | +Errors are always logged at <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.logging/java/util/logging/Level.html#WARNING" title="class or interface in java.util.logging" class="external-link"><code>Level.WARNING</code></a> |
| 92 | +regardless of whether an error handler is set. The error handler provides |
| 93 | +additional custom handling such as metrics, alerts, or integration with |
| 94 | +external error-reporting systems: |
| 95 | + |
| 96 | +<pre><code>session.setEventErrorHandler((event, exception) -> { |
| 97 | + metrics.increment("handler.errors"); |
| 98 | + logger.error("Handler failed on {}: {}", event.getType(), exception.getMessage()); |
| 99 | +}); |
| 100 | +</code></pre> |
| 101 | + |
| 102 | +<p> |
| 103 | +Whether dispatch continues or stops after an error is controlled by the |
| 104 | +<a href="EventErrorPolicy.html" title="enum class in com.github.copilot"><code>EventErrorPolicy</code></a> set via |
| 105 | +<a href="CopilotSession.html#setEventErrorPolicy(com.github.copilot.EventErrorPolicy)"><code>CopilotSession.setEventErrorPolicy(EventErrorPolicy)</code></a>. The error |
| 106 | +handler is always invoked regardless of the policy. |
| 107 | + |
| 108 | +<p> |
| 109 | +If the error handler itself throws an exception, that exception is caught and |
| 110 | +logged at <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.logging/java/util/logging/Level.html#SEVERE" title="class or interface in java.util.logging" class="external-link"><code>Level.SEVERE</code></a>, and dispatch is stopped |
| 111 | +regardless of the configured policy.</div> |
| 112 | +<dl class="notes"> |
| 113 | +<dt>Since:</dt> |
| 114 | +<dd>1.0.8</dd> |
| 115 | +<dt>See Also:</dt> |
| 116 | +<dd> |
| 117 | +<ul class="tag-list-long"> |
| 118 | +<li><a href="CopilotSession.html#setEventErrorHandler(com.github.copilot.EventErrorHandler)"><code>CopilotSession.setEventErrorHandler(EventErrorHandler)</code></a></li> |
| 119 | +<li><a href="EventErrorPolicy.html" title="enum class in com.github.copilot"><code>EventErrorPolicy</code></a></li> |
| 120 | +</ul> |
| 121 | +</dd> |
| 122 | +</dl> |
| 123 | +</div> |
| 124 | +</section> |
| 125 | +<section class="summary"> |
| 126 | +<ul class="summary-list"> |
| 127 | +<!-- ========== METHOD SUMMARY =========== --> |
| 128 | +<li> |
| 129 | +<section class="method-summary" id="method-summary"> |
| 130 | +<h2>Method Summary</h2> |
| 131 | +<div id="method-summary-table"> |
| 132 | +<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab3" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab3', 3)" class="table-tab">Abstract Methods</button></div> |
| 133 | +<div id="method-summary-table.tabpanel" role="tabpanel" aria-labelledby="method-summary-table-tab0"> |
| 134 | +<div class="summary-table three-column-summary"> |
| 135 | +<div class="table-header col-first">Modifier and Type</div> |
| 136 | +<div class="table-header col-second">Method</div> |
| 137 | +<div class="table-header col-last">Description</div> |
| 138 | +<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>void</code></div> |
| 139 | +<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#handleError(com.github.copilot.generated.SessionEvent,java.lang.Exception)" class="member-name-link">handleError</a><wbr>(<a href="generated/SessionEvent.html" title="class in com.github.copilot.generated">SessionEvent</a> event, |
| 140 | + <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Exception.html" title="class or interface in java.lang" class="external-link">Exception</a> exception)</code></div> |
| 141 | +<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"> |
| 142 | +<div class="block">Called when an event handler throws an exception during event dispatch.</div> |
| 143 | +</div> |
| 144 | +</div> |
| 145 | +</div> |
| 146 | +</div> |
| 147 | +</section> |
| 148 | +</li> |
| 149 | +</ul> |
| 150 | +</section> |
| 151 | +<section class="details"> |
| 152 | +<ul class="details-list"> |
| 153 | +<!-- ============ METHOD DETAIL ========== --> |
| 154 | +<li> |
| 155 | +<section class="method-details" id="method-detail"> |
| 156 | +<h2>Method Details</h2> |
| 157 | +<ul class="member-list"> |
| 158 | +<li> |
| 159 | +<section class="detail" id="handleError(com.github.copilot.generated.SessionEvent,java.lang.Exception)"> |
| 160 | +<h3>handleError</h3> |
| 161 | +<div class="horizontal-scroll"> |
| 162 | +<div class="member-signature"><span class="return-type">void</span> <span class="element-name">handleError</span><wbr><span class="parameters">(<a href="generated/SessionEvent.html" title="class in com.github.copilot.generated">SessionEvent</a> event, |
| 163 | + <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Exception.html" title="class or interface in java.lang" class="external-link">Exception</a> exception)</span></div> |
| 164 | +<div class="block">Called when an event handler throws an exception during event dispatch.</div> |
| 165 | +<dl class="notes"> |
| 166 | +<dt>Parameters:</dt> |
| 167 | +<dd><code>event</code> - the event that was being dispatched when the error occurred</dd> |
| 168 | +<dd><code>exception</code> - the exception thrown by the event handler</dd> |
| 169 | +</dl> |
| 170 | +</div> |
| 171 | +</section> |
| 172 | +</li> |
| 173 | +</ul> |
| 174 | +</section> |
| 175 | +</li> |
| 176 | +</ul> |
| 177 | +</section> |
| 178 | +<!-- ========= END OF CLASS DATA ========= --> |
| 179 | +<footer role="contentinfo"> |
| 180 | +<hr> |
| 181 | +<p class="legal-copy"><small>Copyright © 2026. All rights reserved.</small></p> |
| 182 | +</footer> |
| 183 | +</main> |
| 184 | +</div> |
| 185 | +</body> |
| 186 | +</html> |
0 commit comments