Skip to content

Commit d7b6d9a

Browse files
refactor: remove slack call on error
1 parent 51b136a commit d7b6d9a

13 files changed

+1
-343
lines changed

packages/architect_server/docker-compose.override.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: "3"
2-
31
services:
42
server:
53
build:

packages/architect_server/docker-compose.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: "3"
2-
31
services:
42
server:
53
build:
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
export './src/config.dart';
21
export './src/controllers/controllers.dart';
3-
export './src/domain/domain.dart';
42
export './src/handler.dart';
53
export './src/operations/operations.dart';

packages/architect_server/lib/src/config.dart

-6
This file was deleted.

packages/architect_server/lib/src/domain/domain.dart

-9
This file was deleted.

packages/architect_server/lib/src/generated/nl_pipbo_slack_v0_client.dart

-54
This file was deleted.

packages/architect_server/lib/src/generated/nl_pipbo_slack_v0_json.dart

-173
This file was deleted.

packages/architect_server/lib/src/operations/healthcheck/show_healthcheck.dart

-10
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
1-
import 'package:architect_server/architect_server.dart';
2-
31
import '../../generated/io_apibuilder_generator_v0_json.dart' as i1;
42

53
class CreateShowHealthcheck {
64
//
75
const CreateShowHealthcheck();
86

97
Future<i1.Healthcheck> call() async {
10-
// Ensure all environment variables are available.
11-
if (slackWebhookUrl.isEmpty) {
12-
throw const i1.Error(
13-
code: 'environment-error',
14-
message: 'The variable with key `SLACK_WEBHOOK_URL` is unavailable.',
15-
);
16-
}
17-
188
return const i1.Healthcheck(
199
status: 'healthy',
2010
);

packages/architect_server/lib/src/operations/invocation/add_invocation.dart

-43
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
11
import 'package:architect/architect.dart';
22

33
import '../../generated/io_apibuilder_generator_v0_json.dart' as i1;
4-
import '../../generated/nl_pipbo_slack_v0_json.dart' as i2;
54

65
class CreateAddInvocation {
76
//
87
const CreateAddInvocation(
98
this.showGenerator,
10-
this.addMessage,
119
);
1210

1311
final Future<Generator> Function(
1412
String key,
1513
) showGenerator;
1614

17-
final Future<void> Function(
18-
i2.Message message,
19-
) addMessage;
20-
2115
Future<i1.Invocation> call(
2216
String key,
2317
i1.InvocationForm form,
@@ -30,43 +24,6 @@ class CreateAddInvocation {
3024
return i1.Invocation.fromJson(output);
3125
} //
3226
catch (e) {
33-
final text = ' '
34-
'An error occured during the invocation of the `${generator.key}` '
35-
'generator!';
36-
37-
final message = i2.Message(
38-
username: 'architect',
39-
text: text,
40-
attachments: [
41-
i2.Attachment(
42-
fallback: '',
43-
color: '#bdbdbd',
44-
fields: [
45-
i2.Field(
46-
title: 'Environment',
47-
value: ' '
48-
'${form.service.namespace}\n'
49-
'${form.userAgent}',
50-
short: false,
51-
),
52-
],
53-
),
54-
i2.Attachment(
55-
fallback: '',
56-
color: '#f44336',
57-
fields: [
58-
i2.Field(
59-
title: 'Error',
60-
value: e.toString(),
61-
short: false,
62-
),
63-
],
64-
),
65-
],
66-
);
67-
68-
await addMessage(message);
69-
7027
throw i1.Error(
7128
code: 'invocation-error',
7229
message: e.toString(),

packages/architect_server/lib/src/operations/message/add_message.dart

-20
This file was deleted.

packages/architect_server/lib/src/operations/operations.dart

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ export './generator/list_generators.dart';
55
export './generator/show_generator.dart';
66
export './healthcheck/show_healthcheck.dart';
77
export './invocation/add_invocation.dart';
8-
export './message/add_message.dart';
9-
10-
final addMessage = CreateAddMessage(client);
118

129
const listGenerators = CreateListGenerators(generators);
1310
const showGenerator = CreateShowGenerator(generators);
1411
const showHealthcheck = CreateShowHealthcheck();
15-
final addInvocation = CreateAddInvocation(showGenerator.call, addMessage.call);
12+
final addInvocation = CreateAddInvocation(showGenerator.call);

0 commit comments

Comments
 (0)