| 287 | } |
| 288 | |
| 289 | func (e BuildError) Response() (int, codersdk.Response) { |
| 290 | // If the wrapped error knows how to produce its own response |
| 291 | // (e.g. DiagnosticError with Validations), prefer that over |
| 292 | // the generic BuildError response. |
| 293 | if inner, ok := httperror.IsResponder(e.Wrapped); ok { |
| 294 | return inner.Response() |
| 295 | } |
| 296 | |
| 297 | return e.Status, codersdk.Response{ |
| 298 | Message: e.Message, |
| 299 | Detail: e.Error(), |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | // Build computes and inserts a new workspace build into the database. If authFunc is provided, it also performs |
| 304 | // authorization preflight checks. |