-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathEventErrorPolicy.java.html
More file actions
68 lines (64 loc) · 3.89 KB
/
Copy pathEventErrorPolicy.java.html
File metadata and controls
68 lines (64 loc) · 3.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang=""><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>EventErrorPolicy.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">GitHub Copilot SDK :: Java</a> > <a href="index.source.html" class="el_package">com.github.copilot</a> > <span class="el_source">EventErrorPolicy.java</span></div><h1>EventErrorPolicy.java</h1><pre class="source lang-java linenums">/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/
package com.github.copilot;
/**
* Controls how event dispatch behaves when an event handler throws an
* exception.
* <p>
* This policy is set via
* {@link CopilotSession#setEventErrorPolicy(EventErrorPolicy)} and determines
* whether remaining event listeners continue to execute after a preceding
* listener throws an exception. Errors are always logged at
* {@link java.util.logging.Level#WARNING} regardless of the policy.
*
* <p>
* The configured {@link EventErrorHandler} (if any) is always invoked
* regardless of the policy — the policy only controls whether dispatch
* continues after the error has been logged and the error handler has been
* called.
*
* <p>
* The naming follows the convention used by Spring Framework's
* {@code TaskUtils.LOG_AND_SUPPRESS_ERROR_HANDLER} and
* {@code TaskUtils.LOG_AND_PROPAGATE_ERROR_HANDLER}.
*
* <p>
* <b>Example:</b>
*
* <pre>{@code
* // Default: propagate errors (stop dispatch on first error, log the error)
* session.setEventErrorPolicy(EventErrorPolicy.PROPAGATE_AND_LOG_ERRORS);
*
* // Opt-in to suppress errors (continue dispatching, log each error)
* session.setEventErrorPolicy(EventErrorPolicy.SUPPRESS_AND_LOG_ERRORS);
* }</pre>
*
* @see CopilotSession#setEventErrorPolicy(EventErrorPolicy)
* @see EventErrorHandler
* @since 1.0.8
*/
<span class="nc" id="L43">public enum EventErrorPolicy {</span>
/**
* Suppress errors: log the error and continue dispatching to remaining
* listeners.
* <p>
* When a handler throws an exception, the error is logged at
* {@link java.util.logging.Level#WARNING} and remaining handlers still execute.
* The configured {@link EventErrorHandler} is called for each error. This is
* analogous to Spring's {@code LOG_AND_SUPPRESS_ERROR_HANDLER} behavior.
*/
<span class="nc" id="L54"> SUPPRESS_AND_LOG_ERRORS,</span>
/**
* Propagate errors: log the error and stop dispatch on first listener error
* (default).
* <p>
* When a handler throws an exception, the error is logged at
* {@link java.util.logging.Level#WARNING} and no further handlers are invoked.
* The configured {@link EventErrorHandler} is still called before dispatch
* stops. This is analogous to Spring's {@code LOG_AND_PROPAGATE_ERROR_HANDLER}
* behavior.
*/
<span class="nc" id="L66"> PROPAGATE_AND_LOG_ERRORS</span>
}
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.14.202510111229</span></div></body></html>