| 
									
										
										
										
											2024-03-08 15:50:54 -06:00
										 |  |  | // package main is the main package for the LapisDeploy program | 
					
						
							| 
									
										
										
										
											2024-03-08 15:36:11 -06:00
										 |  |  | package main | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-10 21:22:05 -05:00
										 |  |  | import ( | 
					
						
							|  |  |  | 	"fmt" | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-08 15:36:11 -06:00
										 |  |  | // DeployError contains important information about an error if something went wrong. | 
					
						
							|  |  |  | type DeployError struct { | 
					
						
							| 
									
										
										
										
											2024-04-12 11:19:43 -05:00
										 |  |  | 	code           int | 
					
						
							|  |  |  | 	where          string | 
					
						
							|  |  |  | 	details        string | 
					
						
							| 
									
										
										
										
											2024-03-08 15:36:11 -06:00
										 |  |  | 	command_output string | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-10 21:22:05 -05:00
										 |  |  | // SendOverMatrix provides an easy way to send the contents of a DeployError over Matrix | 
					
						
							|  |  |  | func (deploy_error *DeployError) SendOverMatrix() { | 
					
						
							| 
									
										
										
										
											2024-04-12 11:19:43 -05:00
										 |  |  | 	sendMessage(MatrixMessage{text: fmt.Sprintf("%s**Error in **`%s`**!**\n- *%s*\n- Code: %d", | 
					
						
							|  |  |  | 		Circles["red"], deploy_error.where, deploy_error.details, deploy_error.code), | 
					
						
							| 
									
										
										
										
											2024-03-10 21:22:05 -05:00
										 |  |  | 	}) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-12 11:19:43 -05:00
										 |  |  | // newDeployError creates a DeployError | 
					
						
							| 
									
										
										
										
											2024-03-08 15:36:11 -06:00
										 |  |  | func newDeployError(code int, where string, details string, command_output string) DeployError { | 
					
						
							| 
									
										
										
										
											2024-04-12 11:19:43 -05:00
										 |  |  | 	return DeployError{code: code, where: where, details: details, command_output: command_output} | 
					
						
							| 
									
										
										
										
											2024-03-08 15:36:11 -06:00
										 |  |  | } |