| 
									
										
										
										
											2022-09-15 00:19:57 +08:00
										 |  |  | package plugins | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-13 12:11:35 +08:00
										 |  |  | import "github.com/grafana/grafana/pkg/apimachinery/errutil" | 
					
						
							| 
									
										
										
										
											2022-09-15 00:19:57 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | var ( | 
					
						
							| 
									
										
										
										
											2023-09-25 17:56:03 +08:00
										 |  |  | 	errPluginNotRegisteredBase = errutil.NotFound("plugin.notRegistered", | 
					
						
							|  |  |  | 		errutil.WithPublicMessage("Plugin not registered")) | 
					
						
							| 
									
										
										
										
											2022-09-15 00:19:57 +08:00
										 |  |  | 	// ErrPluginNotRegistered error returned when a plugin is not registered.
 | 
					
						
							| 
									
										
										
										
											2023-09-25 17:56:03 +08:00
										 |  |  | 	ErrPluginNotRegistered = errPluginNotRegisteredBase.Errorf("plugin not registered") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	errPluginUnavailableBase = errutil.Internal("plugin.unavailable", | 
					
						
							|  |  |  | 		errutil.WithPublicMessage("Plugin unavailable")) | 
					
						
							| 
									
										
										
										
											2022-09-15 00:19:57 +08:00
										 |  |  | 	// ErrPluginUnavailable error returned when a plugin is unavailable.
 | 
					
						
							| 
									
										
										
										
											2023-09-25 17:56:03 +08:00
										 |  |  | 	ErrPluginUnavailable = errPluginUnavailableBase.Errorf("plugin unavailable") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	errMethodNotImplementedBase = errutil.NotFound("plugin.notImplemented", | 
					
						
							|  |  |  | 		errutil.WithPublicMessage("Method not implemented")) | 
					
						
							| 
									
										
										
										
											2022-09-15 00:19:57 +08:00
										 |  |  | 	// ErrMethodNotImplemented error returned when a plugin method is not implemented.
 | 
					
						
							| 
									
										
										
										
											2023-09-25 17:56:03 +08:00
										 |  |  | 	ErrMethodNotImplemented = errMethodNotImplementedBase.Errorf("method not implemented") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-27 15:44:43 +08:00
										 |  |  | 	// ErrPluginHealthCheck error returned when a plugin fails its health check.
 | 
					
						
							|  |  |  | 	// Exposed as a base error to wrap it with plugin error.
 | 
					
						
							|  |  |  | 	ErrPluginHealthCheck = errutil.Internal("plugin.healthCheck", | 
					
						
							|  |  |  | 		errutil.WithPublicMessage("Plugin health check failed"), | 
					
						
							|  |  |  | 		errutil.WithDownstream()) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-17 16:27:45 +08:00
										 |  |  | 	// ErrPluginDownstreamErrorBase error returned when a plugin request fails.
 | 
					
						
							| 
									
										
										
										
											2023-09-25 17:56:03 +08:00
										 |  |  | 	// Exposed as a base error to wrap it with plugin downstream errors.
 | 
					
						
							|  |  |  | 	ErrPluginDownstreamErrorBase = errutil.Internal("plugin.downstreamError", | 
					
						
							| 
									
										
										
										
											2023-09-11 18:13:13 +08:00
										 |  |  | 		errutil.WithPublicMessage("An error occurred within the plugin"), | 
					
						
							|  |  |  | 		errutil.WithDownstream()) | 
					
						
							| 
									
										
										
										
											2023-10-10 18:28:39 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// ErrPluginRequestCanceledErrorBase error returned when a plugin request
 | 
					
						
							|  |  |  | 	// is cancelled by the client (context is cancelled).
 | 
					
						
							|  |  |  | 	// Exposed as a base error to wrap it with plugin cancelled errors.
 | 
					
						
							|  |  |  | 	ErrPluginRequestCanceledErrorBase = errutil.ClientClosedRequest("plugin.requestCanceled", | 
					
						
							|  |  |  | 		errutil.WithPublicMessage("Plugin request canceled")) | 
					
						
							| 
									
										
										
										
											2022-09-15 00:19:57 +08:00
										 |  |  | ) |