@@ -30,7 +30,7 @@ func Compile(ctx context.Context, req *rpc.CompileReq) (*rpc.CompileResp, error)
30
30
if err != nil {
31
31
return & rpc.CompileResp {
32
32
Result : rpc .Error ("Error opening sketch" , rpc .ErrGeneric ),
33
- }, nil
33
+ }, err
34
34
}
35
35
36
36
fqbnIn := req .GetFqbn ()
@@ -41,14 +41,14 @@ func Compile(ctx context.Context, req *rpc.CompileReq) (*rpc.CompileResp, error)
41
41
formatter .PrintErrorMessage ("No Fully Qualified Board Name provided." )
42
42
return & rpc.CompileResp {
43
43
Result : rpc .Error ("No Fully Qualified Board Name provided." , rpc .ErrGeneric ),
44
- }, nil
44
+ }, err
45
45
}
46
46
fqbn , err := cores .ParseFQBN (fqbnIn )
47
47
if err != nil {
48
48
formatter .PrintErrorMessage ("Fully Qualified Board Name has incorrect format." )
49
49
return & rpc.CompileResp {
50
50
Result : rpc .Error ("Fully Qualified Board Name has incorrect format." , rpc .ErrGeneric ),
51
- }, nil
51
+ }, err
52
52
}
53
53
54
54
pm , _ := cli .InitPackageAndLibraryManager ()
@@ -64,14 +64,14 @@ func Compile(ctx context.Context, req *rpc.CompileReq) (*rpc.CompileResp, error)
64
64
if err := pm .LoadHardware (cli .Config ); err != nil {
65
65
return & rpc.CompileResp {
66
66
Result : rpc .Error ("Could not load hardware packages." , rpc .ErrGeneric ),
67
- }, nil
67
+ }, err
68
68
}
69
69
ctags , _ = getBuiltinCtagsTool (pm )
70
70
if ! ctags .IsInstalled () {
71
71
formatter .PrintErrorMessage ("Missing ctags tool." )
72
72
return & rpc.CompileResp {
73
73
Result : rpc .Error ("Missing ctags tool." , rpc .ErrGeneric ),
74
- }, nil
74
+ }, err
75
75
}
76
76
}
77
77
@@ -86,7 +86,7 @@ func Compile(ctx context.Context, req *rpc.CompileReq) (*rpc.CompileResp, error)
86
86
formatter .PrintErrorMessage (errorMessage )
87
87
return & rpc.CompileResp {
88
88
Result : rpc .Error (errorMessage , rpc .ErrGeneric ),
89
- }, nil
89
+ }, err
90
90
}
91
91
92
92
builderCtx := & types.Context {}
@@ -100,15 +100,15 @@ func Compile(ctx context.Context, req *rpc.CompileReq) (*rpc.CompileResp, error)
100
100
} else {
101
101
return & rpc.CompileResp {
102
102
Result : rpc .Error ("Cannot get hardware directories." , rpc .ErrGeneric ),
103
- }, nil
103
+ }, err
104
104
}
105
105
106
106
if toolsDir , err := cli .Config .BundleToolsDirectories (); err == nil {
107
107
builderCtx .ToolsDirs = toolsDir
108
108
} else {
109
109
return & rpc.CompileResp {
110
110
Result : rpc .Error ("Cannot get bundled tools directories." , rpc .ErrGeneric ),
111
- }, nil
111
+ }, err
112
112
}
113
113
114
114
builderCtx .OtherLibrariesDirs = paths .NewPathList ()
@@ -120,7 +120,7 @@ func Compile(ctx context.Context, req *rpc.CompileReq) (*rpc.CompileResp, error)
120
120
if err != nil {
121
121
return & rpc.CompileResp {
122
122
Result : rpc .Error ("Cannot create the build directory." , rpc .ErrGeneric ),
123
- }, nil
123
+ }, err
124
124
}
125
125
}
126
126
@@ -145,7 +145,7 @@ func Compile(ctx context.Context, req *rpc.CompileReq) (*rpc.CompileResp, error)
145
145
if err != nil {
146
146
return & rpc.CompileResp {
147
147
Result : rpc .Error ("Cannot create the build cache directory." , rpc .ErrGeneric ),
148
- }, nil
148
+ }, err
149
149
}
150
150
}
151
151
@@ -181,7 +181,7 @@ func Compile(ctx context.Context, req *rpc.CompileReq) (*rpc.CompileResp, error)
181
181
if err != nil {
182
182
return & rpc.CompileResp {
183
183
Result : rpc .Error ("Compilation failed." , rpc .ErrGeneric ),
184
- }, nil
184
+ }, err
185
185
}
186
186
187
187
// FIXME: Make a function to obtain these info...
@@ -213,7 +213,7 @@ func Compile(ctx context.Context, req *rpc.CompileReq) (*rpc.CompileResp, error)
213
213
if err = srcHex .CopyTo (dstHex ); err != nil {
214
214
return & rpc.CompileResp {
215
215
Result : rpc .Error ("Error copying output file." , rpc .ErrGeneric ),
216
- }, nil
216
+ }, err
217
217
}
218
218
219
219
// Copy .elf file to sketch directory
@@ -224,7 +224,7 @@ func Compile(ctx context.Context, req *rpc.CompileReq) (*rpc.CompileResp, error)
224
224
formatter .PrintError (err , "Error copying elf file." )
225
225
return & rpc.CompileResp {
226
226
Result : rpc .Error ("Error copying elf file." , rpc .ErrGeneric ),
227
- }, nil
227
+ }, err
228
228
}
229
229
230
230
return & rpc.CompileResp {}, nil
0 commit comments