Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

Commit

Permalink
Merge branch 'main' into kjuell/react-imports
Browse files Browse the repository at this point in the history
  • Loading branch information
ltagliaferri authored Aug 12, 2021
2 parents 6a20b8c + d01b052 commit d12397b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
34 changes: 34 additions & 0 deletions posts/how-to-find-error-messages-with-sourcegraph.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: How To Find Error Messages with Sourcegraph (Video)
author: marek-zaluski
tags: [video, search, sourcegraph]
description: Learn about finding error messages in your code with Sourcegraph.
image: /headers/how-to-find-error-messages-with-sourcegraph-thumbnail.jpg
imageAlt: Marek talking about finding error messages with Sourcegraph.
type: posts
---

<EmbeddedYoutubeVideo id="M4zlcZJ2fOA" />

## Related links

- [Sourcegraph code search](https://sourcegraph.com/search)
- [Sourcegraph docs](https://docs.sourcegraph.com)
- [Read about literal search patterns](/literal-search-patterns)
- [Watch: Three Ways to Search with Sourcegraph (Video)](/three-ways-to-search-video)

## Transcript

Have you ever been faced with an error message and spent a really long time trying to figure out where it was coming from?

My name is Marek. I'm an engineer at Sourcegraph. And I'm going to share with you my own error message story.

A few months ago, I was working on a browser extension in Chrome. And I started seeing this unfamiliar message that I hadn't seen before. It looked something like this. "Extension context invalidated." What does that even mean? I didn't know where this error was being thrown. And I didn't know where to start looking. We were loading code from a few different repositories into this browser extension bundle. So I wasn't sure where this was coming from.

At first, I tried doing some searches right in my editor to try to find an exact match for the text of this error message. But I got nowhere. I didn't find any matches in the repository that I had open at all.

So I'll show you how I actually used Sourcegraph to do a code search that helped me find the answer. By default, Sourcegraph searches for code in literal search mode. That means it looks for an exact match. For an error message, this is pretty convenient. And I can show you by pasting that error message directly into the search box. Now, I don't need to surround this search with quotes, because literal search will by default already search for the entire thing.

As soon as I get results, there's a hint about where this is coming from. And that's in the name of this repository that I'm getting. So I'm seeing chromium as the repository. This gives me a hint that this is part of the Chrome browser itself and actually not at all a part of the code base that I was working on. The chromium source code is in a public GitHub repository, and Sourcegraph searches over public code. This helped me save a lot of time and a lot of struggle to get to the bottom of this error message. And it turns out it was an issue with the way that the browser extension was being reloaded for development.

Sourcegraph's default search mode is great for error messages like this, but if you're looking for patterns, you can also use regular expressions. And you can also use structural search. So you can take a look at our documentation to learn more about that.
4 changes: 2 additions & 2 deletions posts/three-ways-to-search-video.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
title: Three Ways to Search with Sourcegraph (Video)
tags: [video, search, sourcegraph]
author: marek-zaluski
image: https://i3.ytimg.com/vi/XLfE2YuRwvw/maxresdefault.jpg
image: /headers/three-ways-to-search-thumbnail.jpg
imageAlt: Marek Zaluski demos searching with Sourcegraph.
type: posts
---

<EmbeddedYoutubeVideo id="XLfE2YuRwvw" />

In this video:
## In this video

- Literal search ([tutorial](/literal-search-patterns), [docs](https://docs.sourcegraph.com/code_search/reference/queries#literal-search-default))
- Regular expression search ([tutorial](/regular-expression-patterns), ([docs](https://docs.sourcegraph.com/code_search/reference/queries#regular-expression-search))
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/headers/three-ways-to-search-thumbnail.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d12397b

Please sign in to comment.