| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -55,7 +55,7 @@ const { | |||
| 55 | 55 | getOSInformation: _getOSInformation, | |
| 56 | 56 | getTotalMem, | |
| 57 | 57 | getUserInfo, | |
| 58 | - getUptime, | ||
| 58 | + getUptime: _getUptime, | ||
| 59 | 59 | isBigEndian, | |
| 60 | 60 | setPriority: _setPriority | |
| 61 | 61 | } = internalBinding('os'); | |
@@ -80,6 +80,8 @@ const { | |||
| 80 | 80 | const getHomeDirectory = getCheckedFunction(_getHomeDirectory); | |
| 81 | 81 | const getHostname = getCheckedFunction(_getHostname); | |
| 82 | 82 | const getInterfaceAddresses = getCheckedFunction(_getInterfaceAddresses); | |
| 83 | + const getUptime = getCheckedFunction(_getUptime); | ||
| 84 | + | ||
| 83 | 85 | /** | |
| 84 | 86 | * @returns {string} | |
| 85 | 87 | */ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -149,10 +149,15 @@ static void GetTotalMemory(const FunctionCallbackInfo<Value>& args) { | |||
| 149 | 149 | ||
| 150 | 150 | ||
| 151 | 151 | static void GetUptime(const FunctionCallbackInfo<Value>& args) { | |
| 152 | + Environment* env = Environment::GetCurrent(args); | ||
| 152 | 153 | double uptime; | |
| 153 | 154 | int err = uv_uptime(&uptime); | |
| 154 | - if (err == 0) | ||
| 155 | - args.GetReturnValue().Set(uptime); | ||
| 155 | + if (err != 0) { | ||
| 156 | + env->CollectUVExceptionInfo(args[args.Length() - 1], err, "uv_uptime"); | ||
| 157 | + return args.GetReturnValue().SetUndefined(); | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + args.GetReturnValue().Set(uptime); | ||
| 156 | 161 | } | |
| 157 | 162 | ||
| 158 | 163 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments