@@ -4,8 +4,6 @@ open Devkit
4
4
open Common
5
5
6
6
module Github : Api .Github = struct
7
- let log = Log. from " github"
8
-
9
7
let commits_url ~(repo : Github_t.repository ) ~sha =
10
8
String. substr_replace_first ~pattern: " {/sha}" ~with_: sha repo.commits_url
11
9
@@ -21,9 +19,7 @@ module Github : Api.Github = struct
21
19
let url = contents_url ~repo ~path: ctx.config_filename in
22
20
let headers = build_headers ?token:secrets.gh_token () in
23
21
match % lwt http_request ~headers `GET url with
24
- | Error e ->
25
- log#error " error while querying %s: %s" url e;
26
- Lwt. return @@ fmt_error " failed to get config from file %s" url
22
+ | Error e -> Lwt. return @@ fmt_error " error while querying remote: %s\n failed to get config from file %s" e url
27
23
| Ok res ->
28
24
let response = Github_j. content_api_response_of_string res in
29
25
( match response.encoding with
@@ -33,12 +29,13 @@ module Github : Api.Github = struct
33
29
response.content |> String. split_lines |> String. concat |> decode_string_pad |> Config_j. config_of_string
34
30
|> fun res -> Lwt. return @@ Ok res
35
31
with Base64. Invalid_char as exn ->
36
- log#error ~exn " failed to decode base64 in Github response" ;
37
- Lwt. return @@ fmt_error " failed to get config from file %s" url
32
+ let e = Exn. to_string exn in
33
+ Lwt. return
34
+ @@ fmt_error " error while decoding base64 in GitHub response: %s\n failed to get config from file %s" e url
38
35
end
39
36
| encoding ->
40
- log#error " unexpected encoding '%s' in Github response " encoding;
41
- Lwt. return @@ fmt_error " failed to get config from file %s" url
37
+ Lwt. return
38
+ @@ fmt_error " unexpected encoding '%s' in Github response \n failed to get config from file %s" encoding url
42
39
)
43
40
44
41
let get_api_commit ~(ctx : Context.t ) ~repo ~sha =
@@ -47,9 +44,7 @@ module Github : Api.Github = struct
47
44
let headers = build_headers ?token:secrets.gh_token () in
48
45
match % lwt http_request ~headers `GET url with
49
46
| Ok res -> Lwt. return @@ Ok (Github_j. api_commit_of_string res)
50
- | Error e ->
51
- log#error " error while querying %s: %s" url e;
52
- Lwt. return @@ fmt_error " failed to get api commit %s" sha
47
+ | Error e -> Lwt. return @@ fmt_error " error while querying remote: %s\n failed to get api commit from file %s" e url
53
48
end
54
49
55
50
module Slack : Api .Slack = struct
@@ -62,6 +57,5 @@ module Slack : Api.Slack = struct
62
57
match % lwt http_request ~body `POST url with
63
58
| Ok _ -> Lwt. return @@ Ok ()
64
59
| Error e ->
65
- log#error " error while querying %s: %s" url e;
66
- Lwt. return @@ fmt_error " failed to send Slack notification"
60
+ Lwt. return @@ fmt_error " error while querying remote: %s\n failed to send Slack notification to %s" e url
67
61
end
0 commit comments