Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
2b3bfd2f
Unverified
Commit
2b3bfd2f
authored
Jun 25, 2018
by
Marcus Efraimsson
Committed by
GitHub
Jun 25, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12198 from grafana/11868_missing_phantom
enhance error message if phantomjs executable is not found
parents
132df455
f106de0e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
0 deletions
+17
-0
pkg/api/render.go
+11
-0
pkg/services/rendering/interface.go
+1
-0
pkg/services/rendering/phantomjs.go
+5
-0
No files found.
pkg/api/render.go
View file @
2b3bfd2f
...
...
@@ -3,7 +3,9 @@ package api
import
(
"fmt"
"net/http"
"runtime"
"strconv"
"strings"
"time"
m
"github.com/grafana/grafana/pkg/models"
...
...
@@ -55,6 +57,15 @@ func (hs *HTTPServer) RenderToPng(c *m.ReqContext) {
return
}
if
err
!=
nil
&&
err
==
rendering
.
ErrPhantomJSNotInstalled
{
if
strings
.
HasPrefix
(
runtime
.
GOARCH
,
"arm"
)
{
c
.
Handle
(
500
,
"Rendering failed - PhantomJS isn't included in arm build per default"
,
err
)
}
else
{
c
.
Handle
(
500
,
"Rendering failed - PhantomJS isn't installed correctly"
,
err
)
}
return
}
if
err
!=
nil
{
c
.
Handle
(
500
,
"Rendering failed."
,
err
)
return
...
...
pkg/services/rendering/interface.go
View file @
2b3bfd2f
...
...
@@ -10,6 +10,7 @@ import (
var
ErrTimeout
=
errors
.
New
(
"Timeout error. You can set timeout in seconds with &timeout url parameter"
)
var
ErrNoRenderer
=
errors
.
New
(
"No renderer plugin found nor is an external render server configured"
)
var
ErrPhantomJSNotInstalled
=
errors
.
New
(
"PhantomJS executable not found"
)
type
Opts
struct
{
Width
int
...
...
pkg/services/rendering/phantomjs.go
View file @
2b3bfd2f
...
...
@@ -24,6 +24,11 @@ func (rs *RenderingService) renderViaPhantomJS(ctx context.Context, opts Opts) (
url
:=
rs
.
getURL
(
opts
.
Path
)
binPath
,
_
:=
filepath
.
Abs
(
filepath
.
Join
(
rs
.
Cfg
.
PhantomDir
,
executable
))
if
_
,
err
:=
os
.
Stat
(
binPath
);
os
.
IsNotExist
(
err
)
{
rs
.
log
.
Error
(
"executable not found"
,
"executable"
,
binPath
)
return
nil
,
ErrPhantomJSNotInstalled
}
scriptPath
,
_
:=
filepath
.
Abs
(
filepath
.
Join
(
rs
.
Cfg
.
PhantomDir
,
"render.js"
))
pngPath
:=
rs
.
getFilePathForNewImage
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment